Skip to content

Commit

Permalink
MDL-78927 core_user: Profile page missing breadcrumbs if no id=
Browse files Browse the repository at this point in the history
  • Loading branch information
sammarshallou committed Aug 10, 2023
1 parent 1474f74 commit 7199995
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions user/profile.php
Expand Up @@ -42,8 +42,6 @@
$edit = optional_param('edit', null, PARAM_BOOL); // Turn editing on and off.
$reset = optional_param('reset', null, PARAM_BOOL);

$PAGE->set_url('/user/profile.php', array('id' => $userid));

if (!empty($CFG->forceloginforprofiles)) {
require_login();
if (isguestuser()) {
Expand All @@ -60,6 +58,11 @@
}

$userid = $userid ? $userid : $USER->id; // Owner of the page.

// Even if the user didn't supply a userid, we treat page URL as if they did; this is needed
// so navigation works correctly.
$PAGE->set_url('/user/profile.php', ['id' => $userid]);

if ((!$user = $DB->get_record('user', array('id' => $userid))) || ($user->deleted)) {
$PAGE->set_context(context_system::instance());
echo $OUTPUT->header();
Expand Down

0 comments on commit 7199995

Please sign in to comment.