This topic is locked
[SOLVED]

 hide menu item

5/11/2014 7:20:27 AM
PHPRunner General questions
D
droogers author

Hello,
I have a menu and I want to hide the menu item "ledenlijst" if the the value in the field "Soort_lid" is "LID".

To do this I fillid in at Login page -> after succesfull login:

$_SESSION["Soort_lid"] = $data["Soort_lid"];


At "Menu item: modify" I filled in:

if ($_SESSION["Soort_lid"] ="LID")

{

$title = $menuItem->getTitle();

if ($title=="Ledenlijst")

return false;

}

return true;


But this don't work.

Sergey Kornilov admin 5/11/2014

Comparisson operator in PHP is == as opposed to = in your code

if ($_SESSION["Soort_lid"]=="LID")
D
droogers author 5/18/2014

I changed "=" to "==" but this didn't help. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=74824&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />



Comparisson operator in PHP is == as opposed to = in your code

if ($_SESSION["Soort_lid"]=="LID")


Sergey Kornilov admin 5/19/2014

Make sure $_SESSION["Soort_lid"] session variable is populated and equals "LID" i.e. print this variable from that event.

A
Abul 5/21/2014



Hello,
I have a menu and I want to hide the menu item "ledenlijst" if the the value in the field "Soort_lid" is "LID".

To do this I fillid in at Login page -> after succesfull login:

$_SESSION["Soort_lid"] = $data["Soort_lid"];


At "Menu item: modify" I filled in:

if ($_SESSION["Soort_lid"] ="LID")

{

$title = $menuItem->getTitle();

if ($title=="Ledenlijst")

return false;

}

return true;


But this don't work.


I used in my case some think like this bellow and its worked fantastically.

$admin_tables = array('table1','table3','table5','table6','table7','table8','table9','table12');
$rs = CustomQuery("SELECT GroupID FROM portal_ugmembers WHERE UserName = '".$_SESSION['UserID']."'");

$record = db_fetch_array($rs);
if($record['GroupID'] != -1)

{

if(in_array($menuItem->table,$admin_tables))

{

return false;

}

}

return true;