0
votes

We know that Joomla 1.6 and up has access levels groups settings but this little hack could help everyone from 1.5 and up

this there outputs the params from specific Joomla menu item

$menus = &JSite::getMenu();
print_r($menus ->_items[170]);

where 170 are the parameters for menu item id 170 , now there is a setting called published , what I am trying to achieve is show menu item to visitors only by globally setting the $menus ->_items[170]->published to 0 instead 1 when user is logged in

but changing that array value is hard so if you could please just check if you can change the value output from 1 to 0 by using provided info.

f we can get that to work than code snippet could be something like

if ( !$user->id ) { $menus = &JSite::getMenu(); $menus ->_items[170]->set('published',0); }

but set() does not work for menu item id's

Thank you!

1

1 Answers

0
votes

Why not just set the menu item access to registered in the menu parameters? Then the item only displays when the user is logged in. This is a built in behavior in Joomla.