From ee8f39b7a29b4fdff0170f7e5d258f7b9b2e000e Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Fri, 20 Jan 2017 20:30:09 +1100 Subject: [PATCH] MDL-55915 core_user: let fullname() know if user has viewfullnames cap Added $viewfullnames property to the user_selector_base class so anyone using a child class of this class can let it know if user has viewfullnames capability or not. --- user/selector/lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/user/selector/lib.php b/user/selector/lib.php index b8c20c2a3c6..ee0619a4a13 100644 --- a/user/selector/lib.php +++ b/user/selector/lib.php @@ -82,6 +82,9 @@ abstract class user_selector_base { /** @var int this is used to define maximum number of users visible in list */ public $maxusersperpage = 100; + /** @var boolean Whether to override fullname() */ + public $viewfullnames = false; + /** * Constructor. Each subclass must have a constructor with this signature. * @@ -571,7 +574,7 @@ abstract class user_selector_base { * @return string a string representation of the user. */ public function output_user($user) { - $out = fullname($user); + $out = fullname($user, $this->viewfullnames); if ($this->extrafields) { $displayfields = array(); foreach ($this->extrafields as $field) {