mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 05:25:08 +02:00
MDL-79370 user: set profile page URL earlier, avoid subsequent error.
Co-authored-by: Dominique Palumbo <domenico.palumbo@uclouvain.be>
This commit is contained in:
parent
ecddfa6ccd
commit
4e13a9e892
@ -42,6 +42,10 @@ $userid = optional_param('id', 0, PARAM_INT);
|
||||
$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()) {
|
||||
@ -57,12 +61,6 @@ if (!empty($CFG->forceloginforprofiles)) {
|
||||
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user