Header shows Preferred Name instead of First Name + Surname

Hi everyone,

I want to change how the logged-in user’s name is displayed in the top-right header.

At the moment, the system prioritises “Preferred Name”.
However, in our institution we do not use preferred names for display.
We follow a strict structure of:

First Name / Middle Name / Last Name

and in the interface header we want to show only:

“First Name + Last Name”

Example:
If a user’s name is “John Michael Smith”
First Name = John
Preferred Name = Michael
Surname = Smith

the header should display “John Smith”.

The middle name should be stored, but it should not appear in the header or similar UI locations.

I am not trying to rename database fields or change how data is stored.
I only want to control what is displayed for the logged-in user.

Has anyone implemented this requirement, or can you point me to where the header name is generated?

Thanks in advance.

Hi @Mujthaba
Thank you for your question. To achieve this you would need to add a small change to your local codebase. Please navigate to Header.php file and update the return statement at line 185: ‘name’ => …(‘preferredName’).’ '.(‘surname’), by replacing the ‘preferredName’ with ‘firstName’.
This will allow it to display the name as per your requirement. Another easy solution would be to just assign the preferred name same as the first name. Hope this helps! Thanks.

1 Like

Thank you very much Ali , Much Appreciated.

If you don’t mind I needed some more help modifying these kind of elements but cannot find the exact location, can you help me here? It would be a great support. Thank you

Same for all of these I need first name, surname.

Here also its preferredName and Surname but I need firstName and Surname. Can you please help out?

Hello, Ali

Can you please help me here? It would be very helpful.

Hi @Mujthaba
Thank you for your question. I think the best solution in your case would be to assign the preferred name same as the first name since throughout the system, that is the pattern you will come across for displaying student names. Otherwise, it would require to manually change the code in a few places to reflect the name according to your requirements. For example, if a user’s name is John Michael Smith:
First Name = John
Preferred Name = John
Surname = Smith
Official Name = John Michael Smith

If you still wish to make changes to the script, please navigate to the src->Services->Format.php and update the ‘name’ method to include the first name. But then you will be required to update the code in all the places where the Format::name method is employed.

Hope that helps. Thanks.