MDL-25476 messages: switched some notification emails to come from the support contact instead of admin

This commit is contained in:
Andrew Davis
2012-07-02 15:41:29 +08:00
committed by Dan Poltawski
parent c7132d7c93
commit 6737eda426
3 changed files with 7 additions and 5 deletions
+5 -3
View File
@@ -181,7 +181,8 @@ if ($usernew = $userform->get_data()) {
$email_changed_html = '';
if ($CFG->emailchangeconfirmation) {
// Handle change of email carefully for non-trusted users
// Users with 'moodle/user:update' can change their email address immediately
// Other users require a confirmation email
if (isset($usernew->email) and $user->email != $usernew->email && !has_capability('moodle/user:update', $systemcontext)) {
$a = new stdClass();
$a->newemail = $usernew->preference_newemail = $usernew->email;
@@ -235,7 +236,7 @@ if ($usernew = $userform->get_data()) {
// save custom profile fields data
profile_save_data($usernew);
// If email was changed, send confirmation email now
// If email was changed and confirmation is required, send confirmation email now
if ($email_changed && $CFG->emailchangeconfirmation) {
$temp_user = fullclone($user);
$temp_user->email = $usernew->preference_newemail;
@@ -249,7 +250,8 @@ if ($usernew = $userform->get_data()) {
$emailupdatetitle = get_string('emailupdatetitle', 'auth', $a);
//email confirmation directly rather than using messaging so they will definitely get an email
if (!$mail_results = email_to_user($temp_user, get_admin(), $emailupdatetitle, $emailupdatemessage)) {
$supportuser = generate_email_supportuser();
if (!$mail_results = email_to_user($temp_user, $supportuser, $emailupdatetitle, $emailupdatemessage)) {
die("could not send email!");
}
}