Joomla
Joomla Tips and Tricks
#71 - Hide a menu item when user logs in
|
|
| Sunday, 30 August 2009 | |||||||||||||||||||||||||
#71 - Hide a menu item when user logs inThere are times when you need to hide specific menu items when a user has logged on to your Joomla website. This cannot be done using standard functionality, we the following is a simple workaround to allow you to cheat by hiding the menu item when a user logs in. If you want to hide a whole module eg the menu you can used the trick here: #3 - Hiding a menu once logged in So what do we do to hide the menu item for logged in users? A combination of using the Joomla framework (getUser) and a CSS trick (display:none) to hide items. In your template place the following code: $user =& JFactory::getUser(); if( !$user->guest ) ?> <style type="text/css"> .item10 { display:none; } </style> <?php endif; ?> replace the 10 in .item10 with the id of the menu item.NOTE: this only works on the menu if the menu's module is set to 'List'. If you are familiar with CSS you can use it / extend for the style of any menu item you choose
Only registered users can write comments!
Powered by !JoomlaComment 3.26
3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved." |
|||||||||||||||||||||||||
| Last Updated ( Sunday, 30 August 2009 ) | |||||||||||||||||||||||||