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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user