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.
This commit is contained in:
Shamim Rezaie
2017-01-20 20:30:09 +11:00
parent 20b2bbb966
commit ee8f39b7a2
+4 -1
View File
@@ -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) {