Skip to content

Commit

Permalink
Merge branch 'MDL-53139-30' of https://github.com/dg711/moodle into M…
Browse files Browse the repository at this point in the history
…OODLE_30_STABLE
  • Loading branch information
stronk7 committed Mar 15, 2016
2 parents 9e16802 + 8b91709 commit 158a5fe
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions admin/tool/uploaduser/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,18 @@
}
if ($existinguser->$column !== $user->$column) {
if ($column === 'email') {
if ($DB->record_exists('user', array('email'=>$user->email))) {
if ($noemailduplicates) {
$select = $DB->sql_like('email', ':email', false, true, false, '|');
$params = array('email' => $DB->sql_like_escape($user->email, '|'));
if ($DB->record_exists_select('user', $select , $params)) {

$changeincase = core_text::strtolower($existinguser->$column) === core_text::strtolower(
$user->$column);

if ($changeincase) {
// If only case is different then switch to lower case and carry on.
$user->$column = core_text::strtolower($user->$column);
continue;
} else if ($noemailduplicates) {
$upt->track('email', $stremailduplicate, 'error');
$upt->track('status', $strusernotupdated, 'error');
$userserrors++;
Expand Down Expand Up @@ -1177,7 +1187,10 @@
if (!validate_email($rowcols['email'])) {
$rowcols['status'][] = get_string('invalidemail');
}
if ($DB->record_exists('user', array('email'=>$rowcols['email']))) {

$select = $DB->sql_like('email', ':email', false, true, false, '|');
$params = array('email' => $DB->sql_like_escape($rowcols['email'], '|'));
if ($DB->record_exists_select('user', $select , $params)) {
$rowcols['status'][] = $stremailduplicate;
}
}
Expand Down

0 comments on commit 158a5fe

Please sign in to comment.