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 c7132d7 commit 6737eda
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) {
$contact = reset($rusers);
} else {
$contact = get_admin();
$contact = generate_email_supportuser();
}

//directly emailing welcome message rather than using messaging
Expand Down
2 changes: 1 addition & 1 deletion lib/cronlib.php
Expand Up @@ -709,7 +709,7 @@ function notify_login_failures() {
mtrace('Emailing admins about '. $count .' failed login attempts');
foreach ($recip as $admin) {
//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 @@ -181,7 +181,8 @@
$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;
Expand Down Expand Up @@ -235,7 +236,7 @@
// 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;
Expand All @@ -249,7 +250,8 @@
$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!");
}
}
Expand Down

0 comments on commit 6737eda

Please sign in to comment.