From e113214618bd3eb6e92f681f7d16705ed7b82cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Mon, 23 Sep 2013 21:15:19 +0200 Subject: [PATCH] MDL-41176 make sure fresh full user record is used when mailing email confirmation --- user/edit.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user/edit.php b/user/edit.php index 2a060d16ed4..ab1478a329c 100644 --- a/user/edit.php +++ b/user/edit.php @@ -236,15 +236,15 @@ if ($usernew = $userform->get_data()) { // save custom profile fields data profile_save_data($usernew); - // If email was changed and confirmation is required, send confirmation email now + // If email was changed and confirmation is required, send confirmation email now to the new address. if ($email_changed && $CFG->emailchangeconfirmation) { - $temp_user = fullclone($user); + $temp_user = $DB->get_record('user', array('id'=>$user->id), '*', MUST_EXIST); $temp_user->email = $usernew->preference_newemail; $a = new stdClass(); $a->url = $CFG->wwwroot . '/user/emailupdate.php?key=' . $usernew->preference_newemailkey . '&id=' . $user->id; $a->site = format_string($SITE->fullname, true, array('context' => context_course::instance(SITEID))); - $a->fullname = fullname($user, true); + $a->fullname = fullname($temp_user, true); $emailupdatemessage = get_string('emailupdatemessage', 'auth', $a); $emailupdatetitle = get_string('emailupdatetitle', 'auth', $a);