Display Username on sidebar Menu

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
DGarza
User
Posts: 139

Display Username on sidebar Menu

Post by DGarza »

Hello everyone,

I had already noticed that, the Usename is displayed in the top left of the sidebar, my question is, can it be changed to another field in my Users table?

For example I have a field that is the full name, I would like to show that, instead of the Username.

Thank you.


arbei
User
Posts: 9772

Post by arbei »

If you yse v2024, you may use the LoginStatusEvent, see Event Listeners, e.g.

AddListener(LoginStatusEvent::NAME, function(LoginStatusEvent $event) {
    // Log("LoginStatus", $event->getArguments()); // Log the content for viewing in log file
    $event["currentUserName"] = CurrentUserInfo("MyFullNameField"); // Replace "MyFullNameField" by your actual field name
});

DGarza
User
Posts: 139

Post by DGarza »

Thank you, it works perfectly!


ethanlazarus
User
Posts: 71

Post by ethanlazarus »

Hello - I am trying to make this work but can't figure out where to put this code? Please explain where I put this. Thanks!


mobhar
User
Posts: 11905

Post by mobhar »

As mentioned in the Event Listeners link above, you may simply put your code in Global Code server event. It is located under Server Events -> Global -> All Pages.


Post Reply