Skip to content

Commit

Permalink
Merge branch 'MDL-79370-402' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
…into MOODLE_402_STABLE
  • Loading branch information
HuongNV13 authored and snake committed Sep 19, 2023
2 parents f5908f5 + cff812f commit 2afd7e2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions user/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
$edit = optional_param('edit', null, PARAM_BOOL); // Turn editing on and off.
$reset = optional_param('reset', null, PARAM_BOOL);

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

if (!empty($CFG->forceloginforprofiles)) {
require_login();
if (isguestuser()) {
Expand All @@ -57,12 +61,6 @@
require_login();
}

$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 2afd7e2

Please sign in to comment.