Moodle电子邮件确认
当新用户注册时,moodle通过moodle函数从语言文件lang/en/moodle.php向用户发送带有字符串“emailconfirmation”的确认电子邮件:Moodle电子邮件确认,moodle,Moodle,当新用户注册时,moodle通过moodle函数从语言文件lang/en/moodle.php向用户发送带有字符串“emailconfirmation”的确认电子邮件: function send_confirmation_email($user) { global $CFG; $site = get_site(); $supportuser = generate_email_supportuser(); $data = new stdClass(); $data->firstname
function send_confirmation_email($user) {
global $CFG;
$site = get_site();
$supportuser = generate_email_supportuser();
$data = new stdClass();
$data->firstname = fullname($user);
$data->sitename = format_string($site->fullname);
$data->admin = generate_email_signoff();
$subject = get_string('emailconfirmationsubject', '', format_string($site->fullname));
$username = urlencode($user->username);
$username = str_replace('.', '%2E', $username); // prevent problems with trailing dots
$data->link = $CFG->wwwroot .'/login/confirm.php?data='. $user->secret .'/'. $username;
$message = get_string('emailconfirmation', '', $data);
$messagehtml = text_to_html(get_string('emailconfirmation', '', $data), false, false, true);
return email_to_user($user, $subject, $message, $messagehtml);
}
Moodle在确认后重定向到index.php。如何在确认后将$data->链接重定向到自定义页面:
if (send_confirmation_email($user)) {
if (AUTH_CONFIRM_OK = true) {
$urltogo = new moodle_url($CFG->wwwroot . "/coursestat/view.php", array('id' => $statid));
redirect($urltogo);
}
}
else
print_error('auth_noemail','auth_email');
只要使用$data->link,假设它是一个字符串
if (send_confirmation_email($user)) {
// Assuming $data->link is a string?
$urltogo = new moodle_url($data->link);
redirect($urltogo);
}
这条线
if (AUTH_CONFIRM_OK = true) {
没有意义,AUTH\u CONFIRM\u OK
是一个常量。另外,=
是一项作业。我猜你的意思是这样的:
if ($somevariable == AUTH_CONFIRM_OK) {