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:
Matteo Scaramuccia 2013-06-15 12:17:54 +02:00
parent 0ea1fbbb55
commit 243ab45c16

View File

@ -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;
}