MDL-51837 user: Check if user email is set on validation

Add a check if the user's email is set before performing validation on
the user's email address. This is to prevent the warning messages to
be shown in the case of a pending email change which causes the user's
email field to be not included in the Edit profile form.
This commit is contained in:
Jun Pataleta
2015-10-19 16:50:01 -05:00
parent 1b7bf43562
commit b47454f6b7
+1 -1
View File
@@ -259,7 +259,7 @@ class user_editadvanced_form extends moodleform {
}
}
if (!$user or $user->email !== $usernew->email) {
if (!$user or (isset($usernew->email) && $user->email !== $usernew->email)) {
if (!validate_email($usernew->email)) {
$err['email'] = get_string('invalidemail');
} else if (empty($CFG->allowaccountssameemail)