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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user