From 0595d1d5a954a6a0f2529bc77e2673af645bc463 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Tue, 4 Jun 2013 10:39:56 +0800 Subject: [PATCH] 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. --- lib/navigationlib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 7e1576bf112..e2e873e449c 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -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;