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-24 19:01:08 +02:00
committed by Eloy Lafuente (stronk7)
parent 4417a705cf
commit da660f362b
+6 -4
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;
}