mirror of
https://github.com/moodle/moodle.git
synced 2025-01-30 03:58:34 +01:00
MDL-40200 Administration: Return the invalid user message and stop there
To avoid adding duplicate code, 'invalid user' and 'user deleted' checks have been merged together.
This commit is contained in:
parent
0ea1fbbb55
commit
243ab45c16
@ -56,12 +56,14 @@ if (!empty($CFG->forceloginforprofiles)) {
|
||||
}
|
||||
|
||||
$userid = $userid ? $userid : $USER->id; // Owner of the page
|
||||
$user = $DB->get_record('user', array('id' => $userid));
|
||||
|
||||
if ($user->deleted) {
|
||||
if ((!$user = $DB->get_record('user', array('id' => $userid))) || ($user->deleted)) {
|
||||
$PAGE->set_context(context_system::instance());
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->notification(get_string('userdeleted'));
|
||||
if (!$user) {
|
||||
echo $OUTPUT->notification(get_string('invaliduser', 'error'));
|
||||
} else {
|
||||
echo $OUTPUT->notification(get_string('userdeleted'));
|
||||
}
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user