MDL-41369 Set proper context and navigation path for user messages
This commit is contained in:
+15
-6
@@ -83,9 +83,6 @@ if ($viewing != MESSAGE_VIEW_UNREAD_MESSAGES) {
|
||||
|
||||
$PAGE->set_url($url);
|
||||
|
||||
$navigationurl = new moodle_url('/message/index.php', array('user1' => $user1id));
|
||||
navigation_node::override_active_url($navigationurl);
|
||||
|
||||
// Disable message notification popups while the user is viewing their messages
|
||||
$PAGE->set_popup_notification_allowed(false);
|
||||
|
||||
@@ -125,9 +122,21 @@ if (!message_current_user_is_involved($user1, $user2) && !has_capability('moodle
|
||||
print_error('accessdenied','admin');
|
||||
}
|
||||
|
||||
$PAGE->set_context(context_user::instance($user1->id));
|
||||
$PAGE->set_pagelayout('course');
|
||||
$PAGE->navigation->extend_for_user($user1);
|
||||
if (substr($viewing, 0, 7) == MESSAGE_VIEW_COURSE) {
|
||||
$courseid = intval(substr($viewing, 7));
|
||||
require_login($courseid);
|
||||
require_capability('moodle/course:viewparticipants', context_course::instance($courseid));
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
} else {
|
||||
$PAGE->set_pagelayout('course');
|
||||
$PAGE->set_context(context_user::instance($user1->id));
|
||||
}
|
||||
if (!empty($user1->id) && $user1->id != $USER->id) {
|
||||
$PAGE->navigation->extend_for_user($user1);
|
||||
}
|
||||
if (!empty($user2->id) && $user2->id != $USER->id) {
|
||||
$PAGE->navigation->extend_for_user($user2);
|
||||
}
|
||||
|
||||
/// Process any contact maintenance requests there may be
|
||||
if ($addcontact and confirm_sesskey()) {
|
||||
|
||||
Reference in New Issue
Block a user