Skip to content

Commit

Permalink
MDL-40200 Administration: Return the invalid user message and stop there
Browse files Browse the repository at this point in the history
To avoid adding duplicate code, 'invalid user' and 'user deleted' checks
have been merged together.
  • Loading branch information
scara committed Jun 22, 2013
1 parent e978b66 commit da0c3ea
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions user/profile.php
Expand Up @@ -56,12 +56,14 @@
} }


$userid = $userid ? $userid : $USER->id; // Owner of the page $userid = $userid ? $userid : $USER->id; // Owner of the page
$user = $DB->get_record('user', array('id' => $userid)); if ((!$user = $DB->get_record('user', array('id' => $userid))) || ($user->deleted)) {

if ($user->deleted) {
$PAGE->set_context(context_system::instance()); $PAGE->set_context(context_system::instance());
echo $OUTPUT->header(); 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(); echo $OUTPUT->footer();
die; die;
} }
Expand Down

0 comments on commit da0c3ea

Please sign in to comment.