Skip to content

Commit

Permalink
MDL-52781 tool_uploaduser: add invalid data warnings if validation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Apr 21, 2016
1 parent 5e60be8 commit 94a578a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions admin/tool/uploaduser/index.php
Expand Up @@ -212,7 +212,7 @@
// init upload progress tracker
$upt = new uu_progress_tracker();
$upt->start(); // start table

$validation = array();
while ($line = $cir->next()) {
$upt->flush();
$linenum++;
Expand Down Expand Up @@ -1115,9 +1115,14 @@
}
}
}
$validation[$user->username] = core_user::validate($user);
}
$upt->close(); // close table

if (!empty($validation)) {
foreach ($validation as $username => $error) {
\core\notification::warning(get_string('invaliduserdata', 'tool_uploaduser', s($username)));
}
}
$cir->close();
$cir->cleanup(true);

Expand Down
1 change: 1 addition & 0 deletions admin/tool/uploaduser/lang/en/tool_uploaduser.php
Expand Up @@ -33,6 +33,7 @@
$string['encoding'] = 'Encoding';
$string['errormnetadd'] = 'Can not add remote users';
$string['errors'] = 'Errors';
$string['invaliduserdata'] = 'Invalid data detected for user {$a} and it has been automatically cleaned.';
$string['nochanges'] = 'No changes';
$string['pluginname'] = 'User upload';
$string['renameerrors'] = 'Rename errors';
Expand Down

0 comments on commit 94a578a

Please sign in to comment.