• JCacheStorageFile::_deleteFolderJLIB_FILESYSTEM_DELETE_FAILED

Hiding Menu item after logging in

See user ratings User Rating:  / 0

On a Joomla! site I wanted to hide a menu item after a person logged in.
It was a memberlist, that had the same menu title, but the content should be changed to something more detailed after the user had logged in.

My solution was to create 2 menu items with the same text, but different aliases, this is important if you have seo enabled, otherwise I have not found it important.
The first item was marked as "Registered" in "Access level", this menu item contains the most information, specifically the information that should not be visible to the public.

Remember to set this restriction on both the menu item, and the target (in my case a "Contact Category Layout").

The second menu item are created as a standard public page.
Note the "ItemID" at the very right.

Now find and open your index.php file and insert this somewhere, I did it at the top, so that it\'s easy to locate again:
Also I selected the index.php file located in my template fodler, so that future updates will not revert the change.

// Disable some menuitems
$user =& JFactory::getUser();
if ( !$user->guest ) {
echo \'<style type="text/css">\';
echo \'.item10 { display:none; }\';
echo \'</style>\';

Change the "10" in ".item10" to the ItemID you found earlier, note the ItemID 2 is ".item2" not ".item02".

Upload the index.php file again, and the menu item should be gone when logged in.

Happy coding :-)


Sunday, 13 March 2011
You really make your presentation look easy, but I think this subject, I think this is I'll never understand. It seems too complicated for me is very broad. I look forward to your next post, I will tr