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
]]>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
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.
Cheers,
Lina
]]>just to rule this out, have you check that 'Never display usernames' is set to No under Administation/User settings?
Cheers,
Cecilia
]]>Many thanks for this detail information. I found the function in the lib/user.php and I have changed the parameter in lib/searchlib.php, as the below screenshot shows, but it still doesn't show the username, I have cleared the server cache:
Thanks again for your kind help. I really appreciate it. I feel strange, why the change of the code doesn't take effect.
Best wishes,
Lina
]]>
Cheers,
Cecilia
]]>Thank you very much. Could you please advice which code file I'll need to change in order to enable normal users to see username?
I really appreciate your great help.
Cheers,
Lina
]]>It would be a change in the Mahara codebase if you want to display usernames to everyone and not just staff and admins.
Cheers
Kristina
]]>
Many thanks for your suggestions. I've checked your solutions:
1. Change the display name: we have locked all the users' display name, because we use LDAP integration and the display name will be automatically synchronize from LDAP to Mahara. To keep the continuance of data, we have locked this field and users cannot change.
2. Change the code of the group page: there are other situations that normal users want to search other users, not only the group members.
3. The function which can handle who can see usernames: I found a setting in "Administration->Configure site->Site options->User settings->Never display usernames", as the below screenshot shows, this option is currently off, I have tried both "YES" and "NO" options, but seems no effect to either admin or normal users. I'm wondering if this setting is not working or did I miss any other steps in order to make this setting work?
We are currently using Mahara 16.10.1 and plan to upgrade to the latest version next month.
Thanks again for your help.
Best wishes,
Lina
]]>Thank you for your explanation. You could change the display of the name either everywhere on Mahara or just for that one page in the group or groups in general by adjusting the code to display the username. There is a function that handles who can see usernames (staff and institution / site admins). If you modify that you should be able to reach your goal.
Cheers
Kristina
]]>
Many thanks for your reply.
Yes, the group admin is regular user. Because the Chinese students always have same real names, the group admin cannot identify and select the right user just by their display name or real name. And we've integrated Mahara with LDAP, so the display name is actually the real name and they are not allowed to change the display name.
I think the profile picture will be helpful, but if a user didn't upload a profile picture, or they've uploaded a cat or a dog's picture, then the group admin can still not identify who is the right one.
If we could have regular users be able to see the username, it will be great.
Many thanks.
Cheers,
Lina
]]>People with staff and admin permissions typically see the username. I suspect that your group admins are regular users. We don't display the username to regular users as that just makes the name display longer and is most of the time not needed.
Why do your group admins want to see the username rather than the proper name of a person? If your users use a display name and therefore make it harder to find their real name, maybe it were better if they weren't allowed to use a display name.
Would it also help to display a profile picture? Currently, the select box on the group member page is still in the old style. I could imagine that profile pictures could help differentiate between 5 different Mike's.
Cheers
Kristina
]]>
I'm a big fan of Mahara. Our teachers and students love Mahara a lot.
I want to allow the group administrator to see users' username while selecting potential members to invite to the groups. I found that as the site admin, I can see users' information like Mike(mike01), in the brackets, that's the username. But for normal group admin, they cannot see the username. They can only see display name.
I have checked the site settings. The option "Users can hide real names " and "Never display usernames" are both disabled. Why the group admin still cannot see the username?
Could you please help to advise how can I set the settings to allow group admin to see the username?
Many thanks.
Best wishes,
Lina
]]>