Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.

Conflicts:
	user/profile.php
  • Loading branch information...
commit d158acc4ff84a800662df13d320b80e214c759ca 1 parent 4010b22
@scara scara authored stronk7 committed
Showing with 7 additions and 5 deletions.
  1. +7 −5 user/profile.php
View
12 user/profile.php
@@ -56,12 +56,14 @@
}
$userid = $userid ? $userid : $USER->id; // Owner of the page
-$user = $DB->get_record('user', array('id' => $userid));
-
-if ($user->deleted) {
- $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
+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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.