How can we hide the Root Menu and draw again according to userlevel.
Please reply.
How can we hide the Root Menu and draw again according to userlevel.
Please reply.
the following is ok, but this is adding manual menu items. How can we see which menu items allotted to the CurrentUserID
and display them through loop.
function Menu_Rendering(&$Menu) {
if ($Menu->IsRoot) { // Root menu
$Menu->Clear();
$Menu->AddMenuItem(1, "MyName1", "MyMenuText1", "MyPage1.php");
$Menu->AddMenuItem(2, "MyName2", "MyMenuText2", "MyPage2.php");
}
}
Please see the code of "AddMenuItem" method in "class cMenu" from the generated "ewshared11.php" (assume you are using v11).
As you can see, there are 9 parameter in that method. You may play with $allowed (the 7th parameter) so that the menu, for example, will not be allowed to guest user:
$Menu->AddMenuItem(1, "MyName1", "MyMenuText1", "MyPage1.php", -1, "", IsLoggedIn(), FALSE, FALSE);
If you want to allow that menu item only for the user who has CurrentUserID = 1, then try this (no need loop for this):
if (CurrentUserID() == "1") { // logged in user
$Menu->AddMenuItem(1, "MyName1", "MyMenuText1", "MyPage1.php", -1, "", TRUE, FALSE, FALSE);
}