MDL-31463 - navigation - added a context check in the navigation for fullname permission.
authorAdrian Greeve <adrian@moodle.com>
Fri, 3 Feb 2012 03:38:50 +0000 (11:38 +0800)
committerAdrian Greeve <adrian@moodle.com>
Thu, 9 Feb 2012 01:46:37 +0000 (09:46 +0800)
lib/navigationlib.php

index 600298b..e77fcb6 100644 (file)
@@ -1943,7 +1943,8 @@ class global_navigation extends navigation_node {
                 return false;
             }
             // Add a branch for the current user
-            $usernode = $usersnode->add(fullname($user, true), $userviewurl, self::TYPE_USER, null, $user->id);
+            $canseefullname = has_capability('moodle/site:viewfullnames', $coursecontext);
+            $usernode = $usersnode->add(fullname($user, $canseefullname), $userviewurl, self::TYPE_USER, null, $user->id);
 
             if ($this->page->context->contextlevel == CONTEXT_USER && $user->id == $this->page->context->instanceid) {
                 $usernode->make_active();