Comment 3 for bug 1353516

Tony Butler (tonyjbutler) wrote :

Thanks Kristina. So does that mean that the $username parameter of display_name() is redundant, or that the original logic was incorrect? In other words, should the username always be displayed for admins and staff, or only when $username is true?
The original logic,

$addusername = $username || !empty($userto->admin) || !empty($userto->staff);

implies that there are situations where all users should be able to see usernames. Should this logic actually be more like

$addusername = $username && (!empty($userto->admin) || !empty($userto->staff));

or simply

$addusername = !empty($userto->admin) || !empty($userto->staff);

?

 ...

I've had another look, and the documentation for display_name() says:

@param boolean $username show the user's username even if the viewer is not an admin

I suppose the third possibility is that usernames should always be displayed to admins, but only to staff when $username is true (and never to ordinary users).

Let me know what you think.

Cheers,
Tony