This commit is contained in:
Eloy Lafuente (stronk7) 2016-12-20 12:47:54 +01:00
commit 863e1a66a9
2 changed files with 5 additions and 1 deletions

View File

@ -70,6 +70,9 @@
$user = $DB->get_record('user', array('id'=>$delete, 'mnethostid'=>$CFG->mnet_localhost_id), '*', MUST_EXIST);
if ($user->deleted) {
print_error('usernotdeleteddeleted', 'error');
}
if (is_siteadmin($user->id)) {
print_error('useradminodelete', 'error');
}
@ -86,7 +89,7 @@
echo $OUTPUT->confirm(get_string('deletecheckfull', '', "'$fullname'"), $deletebutton, $returnurl);
echo $OUTPUT->footer();
die;
} else if (data_submitted() and !$user->deleted) {
} else if (data_submitted()) {
if (delete_user($user)) {
\core\session\manager::gc(); // Remove stale sessions.
redirect($returnurl);

View File

@ -560,6 +560,7 @@ $string['usernotaddederror'] = 'User not added - error';
$string['usernotaddedregistered'] = 'User not added - already registered';
$string['usernotavailable'] = 'The details of this user are not available to you';
$string['usernotdeletedadmin'] = 'User not deleted - can not delete administrator accounts';
$string['usernotdeleteddeleted'] = 'This user has already been deleted.';
$string['usernotdeletederror'] = 'User not deleted - error';
$string['usernotdeletedmissing'] = 'User not deleted - could not find the username';
$string['usernotdeletedoff'] = 'User not deleted - deleting not allowed';