Greetings,I did one of the project and it almost done.I need to display (welcome: username) in the horizontal menu in the right side.
How can I do it?Thank you in advance
I love phpmaker and I love more their excellent team who support us.
Example of what I always do with each application (change to your own use):Set in Server events/All Pages/Menu_rendering:
if (IsLoggedIn()){
$UserName = CurrentUserInfo("USR_Name");
$UserPermission = CurrentUserInfo("USR_Permission");
$UserPermissionValue = ew_ExecuteScalar("SELECT UserLevelName FROM userlevels WHERE UserLevelID = " . $UserPermission);
$UserDate = date ("d M Y");
echo ". "."<img src='images/user.png'>"." ".$UserName." "."<img src='images/key.png'>"." ".$UserPermissionValue." "."<img src='images/date.png'>"." ".$UserDate." ";
}
Thanks a lot both of you
It is working fine but I want it inside the horizontal menu in this class = “navbar navbar-inverse” in the right
I am using below code
Set in Server events/All Pages/Menu_rendering:if (IsLoggedIn()){$UserName = CurrentUserInfo(“USR_Name”);
$UserPermission = CurrentUserInfo(“USR_Permission”);
$UserPermissionValue = ew_ExecuteScalar(“SELECT UserLevelName FROM userlevels WHERE UserLevelID = " . $UserPermission);
$UserDate = date (“d M Y”);
echo “. “.””.” “.$UserName.” “.”
“.” “.$UserPermissionValue.” “.”
“.” “.$UserDate.” ";
}
HelloWe have now an other solution (german language):
if(CurrentUserName() == "Administrator")
{
$showname = "Administrator";
}
else
{
$showname = CurrentUserInfo("Vorname") . " " . CurrentUserInfo("Nachname");
}
$Menu->AddMenuItem(100,"Benutzer","Benutzer: " . $showname . " - Datum: " . date("d.m.Y"),"." , -1, "TRUE", IsLoggedIn());
$Menu->MoveItem("Benutzer", $Menu->Count() - 1);
Best regards
Hello All,
PHPmaker 2020
it’s a old post, but for all who like to display Username in the horizontal menu go:
Server Event/Global/All Pages/Page Foot and insert
<script type="text/html" class="ew-js-template" data-name="myControlSidebar" data-method="prependTo" data-target="#ew-navbar-right" data-seq="10">
<li class="nav-item">
<a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#">Welcome: <?php echo (CurrentUserName());?></a>
</li>
</script>
This will show Current User Name near user icon
I hope this will help
Please see also: https://discourse.hkvstore.com/t/display-user-name-login-name-in-page-header/3608/1
for some useful code to add the user name to the page header!
To be specif, v2020.0.16 Use this code
echo ’
';This has worked for me.