Forums | Mahara Community

Support /
How to allow group administrator to see username in the potential member list


na li's profile picture
Posts: 61

03 July 2017, 16:03

Hi Cecilia,

Many thanks for your reply. I was on holidays, sorry for the late response.

Yes, the 'Never display usernames' is set to 'No'. But we still cannot see the usernames.

Screen Shot 2017-07-03 at 11.54.56 AM.png.1

Cheers,

Lina

Cecilia Vela's profile picture
Posts: 110

10 July 2017, 15:35

Hello Lina,

Checking the 'display_name' function again, and for what you said about the settings, the preferredname value for each user is not empty.

In the piece of code that decides whether to add the username or not:

if (empty($user->preferredname)) {
$firstlast = full_name($user);
if ($addusername) {
return $firstlast . ' (' . display_username($user) . ')';
}
return $firstlast;
}
else if ($user->id == $userto->id) {
// If viewing our own name, show it how we like it
return $user->preferredname;
}

we see that the line that adds the username won't be reached if the user has set a preferredname. This preferred name can be changed in Content->Profile->About me by changing the 'Display name' field.

If this is the case, then you can modify this code to force it to show the username next to the preferredname or not to ask for the preferredname in the first place.

I hope this helps and you can finally see the usernames.

Cheers,
Cecilia

na li's profile picture
Posts: 61

12 July 2017, 21:21

Hi Cecilia,

Thanks a lot. It works! I changed the code to :

if ($user->id == $userto->id) {
        // If viewing our own name, show it how we like it
        return $user->preferredname;
    }

We can see the username now.

I really really appreciate your kind help.

Thank you very much.

Best wishes,

Lina

13 results