From 95718caae7c13e6990e748053375d99e624c1d7f Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Tue, 26 Jun 2012 11:44:56 +0700 Subject: [PATCH] MDL-25476 messages: switched some notification emails to come from the support contact instead of admin --- enrol/self/lib.php | 2 +- lib/cronlib.php | 2 +- user/edit.php | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/enrol/self/lib.php b/enrol/self/lib.php index 2e425a6791ad1..32c9d48e64312 100644 --- a/enrol/self/lib.php +++ b/enrol/self/lib.php @@ -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 diff --git a/lib/cronlib.php b/lib/cronlib.php index 1f1bddeba7481..962c8a6c3af83 100644 --- a/lib/cronlib.php +++ b/lib/cronlib.php @@ -700,7 +700,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); } } diff --git a/user/edit.php b/user/edit.php index 6fa160819e9e3..2486a7ac803c4 100644 --- a/user/edit.php +++ b/user/edit.php @@ -169,7 +169,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; @@ -223,7 +224,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; @@ -237,7 +238,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!"); } }