Skip to content

Commit

Permalink
MDL-25476 messages: switched some notification emails to come from th…
Browse files Browse the repository at this point in the history
…e support contact instead of admin
  • Loading branch information
andyjdavis authored and danpoltawski committed Jul 2, 2012
1 parent 42ed541 commit 95718ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion enrol/self/lib.php
Expand Up @@ -291,7 +291,7 @@ protected function email_welcome_message($instance, $user) {
if ($rusers) { if ($rusers) {
$contact = reset($rusers); $contact = reset($rusers);
} else { } else {
$contact = get_admin(); $contact = generate_email_supportuser();
} }


//directly emailing welcome message rather than using messaging //directly emailing welcome message rather than using messaging
Expand Down
2 changes: 1 addition & 1 deletion lib/cronlib.php
Expand Up @@ -700,7 +700,7 @@ function notify_login_failures() {
mtrace('Emailing admins about '. $count .' failed login attempts'); mtrace('Emailing admins about '. $count .' failed login attempts');
foreach ($recip as $admin) { foreach ($recip as $admin) {
//emailing the admins directly rather than putting these through the messaging system //emailing the admins directly rather than putting these through the messaging system
email_to_user($admin,get_admin(), $subject, $body); email_to_user($admin, generate_email_supportuser(), $subject, $body);
} }
} }


Expand Down
8 changes: 5 additions & 3 deletions user/edit.php
Expand Up @@ -169,7 +169,8 @@
$email_changed_html = ''; $email_changed_html = '';


if ($CFG->emailchangeconfirmation) { 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)) { if (isset($usernew->email) and $user->email != $usernew->email && !has_capability('moodle/user:update', $systemcontext)) {
$a = new stdClass(); $a = new stdClass();
$a->newemail = $usernew->preference_newemail = $usernew->email; $a->newemail = $usernew->preference_newemail = $usernew->email;
Expand Down Expand Up @@ -223,7 +224,7 @@
// save custom profile fields data // save custom profile fields data
profile_save_data($usernew); 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) { if ($email_changed && $CFG->emailchangeconfirmation) {
$temp_user = fullclone($user); $temp_user = fullclone($user);
$temp_user->email = $usernew->preference_newemail; $temp_user->email = $usernew->preference_newemail;
Expand All @@ -237,7 +238,8 @@
$emailupdatetitle = get_string('emailupdatetitle', 'auth', $a); $emailupdatetitle = get_string('emailupdatetitle', 'auth', $a);


//email confirmation directly rather than using messaging so they will definitely get an email //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!"); die("could not send email!");
} }
} }
Expand Down

0 comments on commit 95718ca

Please sign in to comment.