MDL-12373 - If you can see your user profile, but don't have moodle/course:viewparticipants, you get a link in the nav bar that takes you to an error message - this was repeated in other parts of the user profile that I had not noticed when I fixed this before.
This commit is contained in:
+8
-1
@@ -50,6 +50,11 @@
|
||||
redirect($CFG->wwwroot . "/user/view.php?course={$course->id}");
|
||||
}
|
||||
|
||||
if ($course->id == SITEID) {
|
||||
$coursecontext = get_context_instance(CONTEXT_SYSTEM); // SYSTEM context
|
||||
} else {
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); // Course context
|
||||
}
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
|
||||
|
||||
@@ -145,7 +150,9 @@
|
||||
$userfullname = fullname($user, true);
|
||||
|
||||
$navlinks = array();
|
||||
$navlinks[] = array('name' => $strparticipants, 'link' => "index.php?id=$course->id", 'type' => 'misc');
|
||||
if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) {
|
||||
$navlinks[] = array('name' => $strparticipants, 'link' => "index.php?id=$course->id", 'type' => 'misc');
|
||||
}
|
||||
$navlinks[] = array('name' => $userfullname,
|
||||
'link' => "view.php?id=$user->id&course=$course->id",
|
||||
'type' => 'misc');
|
||||
|
||||
Reference in New Issue
Block a user