MDL-39865 navigation: 'Profile settings for ...' always displayed

Before this patch, 'Profile settings for X' would only be displayed
if X can access the course, which means that if the course is hidden
the node would be hidden as well. We changed this so that the user
needs to be enrolled in the course.
This commit is contained in:
Frederic Massart
2013-06-04 11:07:49 +08:00
parent b6f8a93642
commit 0595d1d5a9
+3 -2
View File
@@ -3906,10 +3906,11 @@ class settings_navigation extends navigation_node {
}
} else {
$canviewusercourse = has_capability('moodle/user:viewdetails', $coursecontext);
$canaccessallgroups = has_capability('moodle/site:accessallgroups', $coursecontext);
if ((!$canviewusercourse && !$canviewuser) || !can_access_course($course, $user->id)) {
$userisenrolled = is_enrolled($coursecontext, $user->id);
if ((!$canviewusercourse && !$canviewuser) || !$userisenrolled) {
return false;
}
$canaccessallgroups = has_capability('moodle/site:accessallgroups', $coursecontext);
if (!$canaccessallgroups && groups_get_course_groupmode($course) == SEPARATEGROUPS) {
// If groups are in use, make sure we can see that group
return false;