MDL-80605 uploaduser: fixed username already existing when mail-matching

This commit is contained in:
Jeremy Schulz
2024-02-19 17:25:13 +01:00
parent 0f8e328e75
commit fbbb39ca62
3 changed files with 34 additions and 0 deletions
+11
View File
@@ -688,6 +688,17 @@ class process {
break;
case UU_USER_ADD_UPDATE:
if ($this->get_match_on_email()) {
if ($usersbyname = $DB->get_records('user', ['username' => $user->username])) {
foreach ($usersbyname as $userbyname) {
if (strtolower($userbyname->email) != strtolower($user->email)) {
$this->usersskipped++;
$this->upt->track('status', get_string('usernotaddedusernameexists', 'error'), 'warning');
$skip = true;
}
}
}
}
break;
case UU_USER_UPDATE: