Display "username" instead of "First name Last Name" in Profile and Navtab

Re: Display "username" instead of "First name Last Name" in Profile and Navtab

by Davo Smith -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You can look through the code of the function and see if there are any hooks available that you could use to override functionality.

In this case, you can see that it is possible to use the $CFG->fullnamedisplay setting to override the way that the full name is displayed (I can't remember if this setting is available in the UI or if it is only available directly in the main config.php). If you set this to 'language' and then override the 'fullnamedisplay' language string to '{$a->username}' then you're most of the way there.

Unfortunately, a large proportion of the places that call 'fullname()', will rely on the function get_all_user_name_fields() to retrieve the user fields needed to output the name. This function does NOT include 'username' - the only way to solve this would be to modify that function to include 'username' in the list of fields loaded.
Average of ratings: Useful (1)