moodle中的双重注册表

Double registration form in moodle

我正在编辑一个基于moodle 的网站,我需要创建一个双重注册表格。第一个已经设置(针对学校),我需要为私人用户创建另一个。最好的方法是什么? 值得复制主要注册文件(signup.php 和 signup_form.php)然后在那里进行更改吗? 非常感谢

我认为最好的解决方案是创建一个新的身份验证插件。

https://docs.moodle.org/dev/Authentication_plugins

也许可以将此处的代码 /auth/email 复制到 /auth/newname - 在代码中用新名称替换电子邮件。

可能扩展 class?所以在 /auth/newname/auth.php

中是这样的
defined('MOODLE_INTERNAL') || die();

require_once($CFG->dirroot . '/auth/email/auth.php');

class auth_plugin_newname extends auth_plugin_email {

    ...

    function can_signup() {
        return true;
    }

    ...

然后复制/login/signup_form.php/auth/newname/signup_form.php

下一点我不太确定,但您可能需要修改 /login/signup.php

绕行

if (empty($CFG->registerauth)) {
    print_error('notlocalisederrormessage', 'error', '', 'Sorry, you may not use this page.');
}
$authplugin = get_auth_plugin($CFG->registerauth);

改为

if (optional_param('newname', false, PARAM_BOOL)) {
    $authplugin = get_auth_plugin('newname');
} else {
    if (empty($CFG->registerauth)) {
        print_error('notlocalisederrormessage', 'error', '', 'Sorry, you may not use this page.');
    }
    $authplugin = get_auth_plugin($CFG->registerauth);
}

然后私人注册使用

http://www.yoursite.com/login/signup.php?newname=1

将 'newname' 替换为您的新身份验证插件的名称。