Hide Menu Item from Registered and Special

General questions relating to Joomla! There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
User avatar
easykey
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Sat Apr 08, 2006 9:59 pm
Location: Herts, UK
Contact:

Hide Menu Item from Registered and Special

Post by easykey » Sat Jan 12, 2008 2:59 pm

I know how to hide menu items and content from Public (by assigning them as Registered or Special)

However is there is a way to hide a menu item from Registered or Admin once logged in (i.e. it is only relevant for the public alone)
I liked Mambo - But I love Joomla :)

User avatar
dhuelsmann
Joomla! Master
Joomla! Master
Posts: 19659
Joined: Sun Oct 02, 2005 12:50 am
Location: Omaha, NE
Contact:

Re: Hide Menu Item from Registered and Special

Post by dhuelsmann » Sat Jan 12, 2008 5:09 pm

easykey wrote: I know how to hide menu items and content from Public (by assigning them as Registered or Special)

However is there is a way to hide a menu item from Registered or Admin once logged in (i.e. it is only relevant for the public alone)
Can't simply hide an item but can a menu (of course the menu could have been created with just one item and no title and positioned at the bottom of another menu and would look like it was all part of one menu).
toubkal wrote: this cannot be done by joomla administration but can be done by template code
you can have a module position in the template that is set to only show when the visitor is not logged in e.g.

Code: Select all

<?php if ( !$my->id ) {?>
        <div id="topmod"><?php mosLoadModules ( 'top', -2 ); ?>
        </div><?php
        } ?>
in this example, only when a user is not logged in dose the module position "top" get shown on the site
Regards, Dave
Past Treasurer Open Source Matters, Inc.
Past Global Moderator
http://www.kiwaniswest.org

bulgin
Joomla! Explorer
Joomla! Explorer
Posts: 285
Joined: Sun Sep 30, 2007 10:18 pm

Re: Hide Menu Item from Registered and Special

Post by bulgin » Sun Feb 03, 2008 8:55 pm

I have the same question and it's a difficult one to search for in this forum and google.  But I like the template answer.  Only thing is -- where exactly would one put that snippet of code?

I also tried as explained to create a new menu item but cannot figure out how to HIDE it from registered view.  The options are only allowing me to SHOW, not hide.

Thanks if you can help.

I'm relatively new but love Joomla.

User avatar
easykey
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Sat Apr 08, 2006 9:59 pm
Location: Herts, UK
Contact:

Re: Hide Menu Item from Registered and Special

Post by easykey » Sun Feb 03, 2008 11:14 pm

I figured it out - Here are more detailed instructions:

1. Create a New Module Position called notreg (in administrator site/ Template Manager / Module Positions  in blank position i.e. 28)

2. Create a new Menu called notregmenu (in Menu / Menu Manager)

3. Go to Modules  / Site Modules and Publish notregmenu Module with option to not show title and in position notreg

4. Now open template index.php (in site / Template Manager / Site Templates - select and click Edit HTML button

5. Exactly where you insert the following code depends on your template but it needs to be positioned somewhere wher your menu appears - in my template I have placed it just after these three lines...

Code: Select all

<!-- BEGIN: LEFT COLUMN -->
		<div id="ja-col1">
		<div class="ja-innerpad">
and here is the code to insert...

Code: Select all

<?php if ( !$my->id ) {?>
        <div id="notregmenu"><?php mosLoadModules ( 'notreg', -2 ); ?>
        </div><?php
        } ?>
I hope this helps
I liked Mambo - But I love Joomla :)

bulgin
Joomla! Explorer
Joomla! Explorer
Posts: 285
Joined: Sun Sep 30, 2007 10:18 pm

Re: Hide Menu Item from Registered and Special

Post by bulgin » Mon Feb 04, 2008 2:17 am

easykey thank you. It seems that this code will hide the menu once it is clicked and after bringing up the associated component link.  However, what I need to do is hide this menu button from the public frontend and have it appear after a user -- any user -- has logged in.

Thanks

bulgin
Joomla! Explorer
Joomla! Explorer
Posts: 285
Joined: Sun Sep 30, 2007 10:18 pm

Re: Hide Menu Item from Registered and Special

Post by bulgin » Mon Feb 04, 2008 2:35 am

got it working :D ;D :pop

Thanks!

User avatar
SOAMJENA
Joomla! Ace
Joomla! Ace
Posts: 1274
Joined: Thu May 01, 2008 12:36 pm
Location: QubeSys Technologies Pvt. Ltd ,INDIA
Contact:

Re: Hide Menu Item from Registered and Special

Post by SOAMJENA » Sat Jul 25, 2009 11:36 am

By this, we can hide a module position. But what about, if we are trying to hide a menu item inside a whole published menu ???

Any tricks or hacks for this ?
Web Design, eCommerce and Software Development
Joomla Premium Extensions,Templates and Support Packages

gabechambers
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu Sep 24, 2009 1:55 am

Re: Hide Menu Item from Registered and Special

Post by gabechambers » Thu Sep 24, 2009 2:05 am

HIDING INDIVIDUAL MENU ITEMS FROM REGISTERED USERS:
However is there is a way to hide a menu item from Registered or Admin once logged in (i.e. it is only relevant for the public alone)
I'm an html guy, the php guys could probably pull this off a little better than me, but here is the solution to removing an individual menu item or list from registered user view. We use the css code visibility:hidden; to hide it and we use width:0px; to get rid of the space it keeps. We have to apply it to the menu items <LI> record, its <a> record, and its <span> record. Drop this code just above your </head> line in the index.php for your template. The number in the class is the menu item number.

Code: Select all

<?php if ( !$my->id ) {}
else {?>
        <style>
			li.item140,
			li.item140 a,
			li.item140 a span {
			visibility:hidden;
			width:0px;
			}
		</style>
<?php
        } ?>
I know the else is messy, like I said, i'm not a php guy, but effective none the less.
You can check out it's implementation at http://208.109.224.42/precision3.com/global. A pretty slick custom joomla skin and application also if I don't say so myself.

[Mod edit - removed self-promotional link]

ericwade
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue May 18, 2010 1:10 pm

Re: Hide Menu Item from Registered and Special

Post by ericwade » Fri Jun 11, 2010 5:10 pm

Someone needs to create a plugin to allow this function from within the Menu Item Edit functions.

sh4n0n
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Dec 13, 2011 3:32 pm
Location: Canada
Contact:

Re: Hide Menu Item from Registered and Special

Post by sh4n0n » Fri Jan 20, 2012 12:54 pm

ericwade wrote:Someone needs to create a plugin to allow this function from within the Menu Item Edit functions.
Image
Hi all.
Full ack on that one. It's a bit of a hassle to get it sorted out manually all the time.. I need to do it on any new site I deploy (quiet a lot!)


Locked

Return to “General Questions - 1.0.x”