MDL-45760 make sure to check permission before setting header
This commit is contained in:
committed by
Dan Poltawski
parent
6eaf5ec8e3
commit
2ca9e09dab
+10
-10
@@ -103,16 +103,6 @@ if ($course->id == SITEID) {
|
||||
$systemcontext = context_system::instance();
|
||||
$personalcontext = context_user::instance($user->id);
|
||||
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_context($personalcontext);
|
||||
if ($USER->id != $user->id) {
|
||||
$PAGE->navigation->extend_for_user($user);
|
||||
} else {
|
||||
if ($node = $PAGE->navigation->find('myprofile', navigation_node::TYPE_ROOTNODE)) {
|
||||
$node->force_open();
|
||||
}
|
||||
}
|
||||
|
||||
// Check access control.
|
||||
if ($user->id == $USER->id) {
|
||||
// Editing own profile - require_login() MUST NOT be used here, it would result in infinite loop!
|
||||
@@ -140,6 +130,16 @@ if ($user->deleted) {
|
||||
die;
|
||||
}
|
||||
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_context($personalcontext);
|
||||
if ($USER->id != $user->id) {
|
||||
$PAGE->navigation->extend_for_user($user);
|
||||
} else {
|
||||
if ($node = $PAGE->navigation->find('myprofile', navigation_node::TYPE_ROOTNODE)) {
|
||||
$node->force_open();
|
||||
}
|
||||
}
|
||||
|
||||
// Process email change cancellation.
|
||||
if ($cancelemailchange) {
|
||||
cancel_email_update($user->id);
|
||||
|
||||
Reference in New Issue
Block a user