MDL-62618 user: Display full names consistently on users page
[moodle.git] / lib / outputrenderers.php
index 5b50374..f941174 100644 (file)
@@ -2482,12 +2482,13 @@ class core_renderer extends renderer_base {
         global $CFG, $DB;
 
         $user = $userpicture->user;
+        $canviewfullnames = has_capability('moodle/site:viewfullnames', context_system::instance());
 
         if ($userpicture->alttext) {
             if (!empty($user->imagealt)) {
                 $alt = $user->imagealt;
             } else {
-                $alt = get_string('pictureof', '', fullname($user));
+                $alt = get_string('pictureof', '', fullname($user, $canviewfullnames));
             }
         } else {
             $alt = '';
@@ -2519,7 +2520,7 @@ class core_renderer extends renderer_base {
 
         // Show fullname together with the picture when desired.
         if ($userpicture->includefullname) {
-            $output .= fullname($userpicture->user);
+            $output .= fullname($userpicture->user, $canviewfullnames);
         }
 
         // then wrap it in link if needed