how to display username that logged on into menu list?
etc:
Welcome John, menu1, menu2, menu3, logout
thanks in advanced
how to display username that logged on into menu list?
etc:
Welcome John, menu1, menu2, menu3, logout
thanks in advanced
try this, it's working for me...
MenuItem_Adding server event:
if ($Item->Id == -1 ) {
if (IsSysAdmin() )
$user="Administrator";
else
$user = $Security->CurrentUserInfo("vorname")." ".$Security->CurrentUserInfo("name"); // Note: change to your own field names in the user table
if (IsLoggedIn() ) {
$Item->Text = '<img border="0" src="phpimages/door_in.png" width="12" height="12" align="top"> <b>Logout</b> ('.$user.')';
$Item->ParentId = 18; // Account // Note: moves the "logout" to another menu-level, change to your own parent menu item ID
}
}
NOTE: This piece of code moves the "logout" to another menu-level and is adding an icon and the name of the user.
Customize template.php and add this :
<!-- header (begin) --><!-- *** Note: Only licensed users are allowed to change the logo *** -->
<div class="ewHeaderRow"><img src="phpimages/mylogo.png" alt="" border="0">
<?php if (IsLoggedIn()) { ?>
<!-- display username -->
<span class="phpmaker"> Welcome: <? echo($_SESSION[EW_SESSION_USER_NAME]);?></span>
Try this in Menu_ItemAdding
after the }
type
if ( IsLoggedIn() )
{
echo "Hi, <b> ".CurrentUserInfo("Name");
}
just change the Name to your user field
thank you erzon
in server event
menuitem_adding
function MenuItem_Adding(&$Item) {
if ( IsLoggedIn() )
{
echo "Hi, <b> ".CurrentUserInfo("Name");
}
return TRUE;
}
in web appear
Hi jacson, Hi jacson, Hi jacson, Hi jacson, Hi jacson,Hi jacson, Hi jacson, Hi jacson, Hi jacson,
The server event menuitem_adding is called as many times as you have menu-items.
You need a logic wich show your echo only one time. Look at my first post!!!
jacson wrote:
i test it
its not working
and logout word is removed from menu
Hi Nicole,
thank you advance
You code Not work stop at line 26 > >> if (IsLoggedIn() ) {
You can fixed
Thank you again