This topic is locked

Help with code in event

11/1/2019 10:34:53 PM
PHPRunner General questions
L
lordkain2 author

Hello, I need some help with this code in the Menu Item: Modify event, this code works:

if ($_SESSION["GroupID"]!="99999999")

{

$title = $menuItem->getTitle();

if ($title=="Datos")

return false;

}

return true;


But this code doesn't work:

if ($_SESSION["GroupID"]!="99999999" or $_SESSION["GroupID"]!="88888888")

{

$title = $menuItem->getTitle();

if ($title=="Datos")

return false;

}

return true;


I have two admin users: 99999999 and 88888888, I want to hide a menu item for all users to except my admins.
What is wrong with my code?
Thanks.

M
mersintarim 11/2/2019



Hello, I need some help with this code in the Menu Item: Modify event, this code works:

if ($_SESSION["GroupID"]!="99999999")

{

$title = $menuItem->getTitle();

if ($title=="Datos")

return false;

}

return true;


But this code doesn't work:

if ($_SESSION["GroupID"]!="99999999" or $_SESSION["GroupID"]!="88888888")

{

$title = $menuItem->getTitle();

if ($title=="Datos")

return false;

}

return true;


I have two admin users: 99999999 and 88888888, I want to hide a menu item for all users to except my admins.
What is wrong with my code?
Thanks.


$items_to_hide="Datos";
$menuItem->getTitle(),$items_to_hide;

N
Nir Frumer 11/3/2019



$items_to_hide="Datos";
$menuItem->getTitle(),$items_to_hide;



hi

looks to me that you compare "GroupID" instead of "UserID"

the first 1 works because it has a NOT condition
hope it helps,