Page 1 of 1

Display Username on sidebar Menu

Posted: Sat Sep 30, 2023 1:02 am
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.


Re: Display Username on sidebar Menu

Posted: Sat Sep 30, 2023 9:43 am
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
});

Re: Display Username on sidebar Menu

Posted: Mon Oct 02, 2023 10:52 pm
by DGarza

Thank you, it works perfectly!


Re: Display Username on sidebar Menu

Posted: Fri Dec 15, 2023 1:27 am
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!


Re: Display Username on sidebar Menu

Posted: Fri Dec 15, 2023 9:14 am
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.