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:
tjhunt
2008-01-09 16:46:19 +00:00
parent 8f4a3ae2f1
commit 79a9b69e28
3 changed files with 26 additions and 7 deletions
+8 -1
View File
@@ -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');