Commit f967bc0e authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Admin users should always see full name

parent a392b8b4
......@@ -1107,9 +1107,12 @@ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='')
* converts a user object to a string representation of the user suitable for
* the current user (or specified user) to see
*
* Both parameters should be objects containing id, preferredname, firstname,
* lastname, admin
*
* @param object the user that you're trying to format to a string
* @param object the user that is looking at the string representation (if left
* blank, will default to the currently logged in user)
* blank, will default to the currently logged in user).
*
* @returns string name to display
*/
......@@ -1133,12 +1136,16 @@ function display_name($user, $userto=null) {
if (!is_object($user)) {
throw new InvalidArgumentException("Invalid user passed to display_name");
}
// if they don't have a preferred name set, just return here
if (empty($user->preferredname)) {
return $user->firstname . ' ' . $user->lastname;
}
if ($userto->admin) {
return $user->preferredname . ' (' . $user->firstname . ' ' . $user->lastname . ')';
}
$prefix = get_config('dbprefix');
$sql = 'SELECT c1.member
FROM ' . $prefix . 'community_member c1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment