Hide username/user icon from navbar

Hi how can I hide the username from the nav bar in v2022? Thanks.

Did you mean user icon at the top right of the generated web application? If so, why?

No that icon is fine, I mean the new username/icon that appears above the navbar options in v2022. For my application users don’t need user icons so it just looks bad there.

Perhaps this would help: https://discourse.hkvstore.com/t/remove-user-name-from-sidebar-menu/4850/1

Hi, thanks for this hint!What if I want the app shows a filed “NickName” or “FullName” stored in the table “users”?Because:

  1. username if for the app (machines),
  2. full name is for documentory (maybe used by owner of the web app or by the customers of the owner),
  3. and nick name is for everyone (as a human being)

Suppose I had a global function:

function CurrentUserScreenName() 
{
    $currentUserNickName = CurrentUserInfo("NickName");
    $currentUserFullName = CurrentUserInfo("FullName");
    $currentUserScreenName = $currentUserNickName ?? $currentUserFullName ?? CurrentUserName();
		return $currentUserScreenName;
}

And when should I call this function? Thanks!

You may try Page_Foot server event.

Thanks for your reply! But how should I call this? Because I looked in to the “/views/layout.php”, there are two kinds of codes, one is PHP GetClientVar(“login”, “currentUserName”), and the other is JS {{:currentUserName}}

You may read:

If you want to customize the dropdown menu for current user in the top navbar, you should find the following template in layout.php, modify as you need and put it in the Page_Foot server event.

<script type="text/html" class="ew-js-template" data-name="login" data-seq="10" data-data="login" data-method="appendTo" data-target=".navbar-nav.ms-auto">

Thanks for your reply! I learned that function SetClientVar in phpfn.php has something to do with this, but I decided not to manipulate the way the username shows.
However, I suggest future versions of PHPMaker provide options to users to decide what name to be shown, because using nicknames could hide the real usernames.

You may try to use Page_Rendering server event to change the login status, e.g.

$login = GetClientVar("login");
$login["currentUserName"] = "My custom user name"; 
SetClientVar("login", $login);

Ah, thank you for your tips!
In my project, the following code runs like magic!$login = GetClientVar(“login”);
$login[“currentUserName”] = CurrentUserScreenName();
SetClientVar(“login”, $login);

As the right side icon is very common, I would like to remove it.
in my right side header there is 2 icons one is for webpush and another is for user icon.

Please help to remove this both without using css or javascript because when there is slow internet it shows and hide it again.
is there any way to do it using the server script.