firstname = fullname($user); $data->sitename = format_string($site->fullname); $data->admin = generate_email_signoff(); // you might change the text here: here I added a note in the mail subject for the admin - Admin configuration - $subject = "Admin confirmation - " . get_string('emailconfirmationsubject', '', format_string($site->fullname)); // calling the original confirmation link here $data->link = $CFG->wwwroot .'/login/confirm_org.php?data='. $user->secret .'/'. urlencode($user->username); // you might change the text here: added an admin message - use the email to send out my own confirmation to the user $message = "This user needs confirmation: " . $user->email . "\n\n"; // original message from moodle $message = $message . get_string('emailconfirmation', '', $data); $messagehtml = text_to_html(get_string('emailconfirmation', '', $data), false, false, true); $user->mailformat = 1; // Always send HTML version as well // changed the email to send it to the supportuser //return email_to_user($user, $supportuser, $subject, $message, $messagehtml); return email_to_user($supportuser, $supportuser, $subject, $message, $messagehtml); } require_once("../config.php"); $data = optional_param('data', '', PARAM_CLEAN); // Formatted as: secret/username $p = optional_param('p', '', PARAM_ALPHANUM); // Old parameter: secret $s = optional_param('s', '', PARAM_CLEAN); // Old parameter: username if (empty($CFG->registerauth)) { error("Sorry, you may not use this page."); } $authplugin = get_auth_plugin($CFG->registerauth); if (!$authplugin->can_confirm()) { error("Sorry, you may not use this page."); } if (!empty($data) || (!empty($p) && !empty($s))) { if (!empty($data)) { $dataelements = explode('/',$data); $usersecret = $dataelements[0]; $username = $dataelements[1]; } else { $usersecret = $p; $username = $s; } // here comes the code to prevent actual confirmation and sending to admin for confirmation instead $user = get_complete_user_data('username', $username); send_confirmation_email_toadmin($user); print_header(get_string("alreadyconfirmed"), get_string("alreadyconfirmed"), array(), ""); print_box_start('generalbox centerpara boxwidthnormal boxaligncenter'); echo "
Your account is send to the admin for confirmation.
\n"; print_box_end(); print_footer(); exit; // from here comes the original code of the confirm.php file - you might delete it $confirmed = $authplugin->user_confirm($username, $usersecret); if ($confirmed == AUTH_CONFIRM_ALREADY) { $user = get_complete_user_data('username', $username); print_header(get_string("alreadyconfirmed"), get_string("alreadyconfirmed"), array(), ""); print_box_start('generalbox centerpara boxwidthnormal boxaligncenter'); echo "".get_string("alreadyconfirmed")."
\n"; print_single_button("$CFG->wwwroot/course/", null, get_string('courses')); print_box_end(); print_footer(); exit; } else if ($confirmed == AUTH_CONFIRM_OK) { // The user has confirmed successfully, let's log them in if (!$USER = get_complete_user_data('username', $username)) { error("Something serious is wrong with the database"); } set_moodle_cookie($USER->username); if ( ! empty($SESSION->wantsurl) ) { // Send them where they were going $goto = $SESSION->wantsurl; unset($SESSION->wantsurl); redirect($goto); } print_header(get_string("confirmed"), get_string("confirmed"), array(), ""); print_box_start('generalbox centerpara boxwidthnormal boxaligncenter'); echo "".get_string("confirmed")."
\n"; print_single_button("$CFG->wwwroot/course/", null, get_string('courses')); print_box_end(); print_footer(); exit; } else { error("Invalid confirmation data"); } } else { error(get_string("errorwhenconfirming")); } redirect("$CFG->wwwroot/"); ?>