MDL-49280 user: Config for allowing duplicate emails

This commit is contained in:
Michael Aherne
2015-08-04 08:46:08 +01:00
parent 032a4fe51c
commit bc9837241f
6 changed files with 18 additions and 5 deletions
+2 -1
View File
@@ -262,7 +262,8 @@ class user_editadvanced_form extends moodleform {
if (!$user or $user->email !== $usernew->email) {
if (!validate_email($usernew->email)) {
$err['email'] = get_string('invalidemail');
} else if ($DB->record_exists('user', array('email' => $usernew->email, 'mnethostid' => $CFG->mnet_localhost_id))) {
} else if (empty($CFG->allowuserstoshareemailaddresses)
and $DB->record_exists('user', array('email' => $usernew->email, 'mnethostid' => $CFG->mnet_localhost_id))) {
$err['email'] = get_string('emailexists');
}
}