Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Hide Menu from Registered Members of Joomla 1.5

Hide Menu from Registered Members of Joomla 1.5

Since I have a tab in my menu that says "Membership Info", which is viewed by the public to spark their interest, I want that tab on the menu to go away after they sign in. There is nothing fancy here, just using joomla and no third party stuff for the menus.

I am using MetaMod v2.5.

Under the menus tab in the admin control panel (back end), I have two menus.  One is TOP MENU (public)-Which is ID 84 and TOP MENU (private) - which is ID 29.  They are located in the position of USER3.  The public menu has aliases created to link to some of the stuff I am pulling from the TOP MENU (private).  So this is like a duplicate menu which was suggested in the documentation.

What is the simplest way with MetaMod to remove a link in the menu when a user becomes registered?

Currently, in the user3 section, both private and public menus are showing.  I have played around with MetaMod and cannot get this to work.

What am I missing here?

Edited By: joomlajim
13-Nov-10 17:06:04

joomlajim
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Hide Menu from Registered Members of Joomla 1.5

Hi Jim,

first off, this is only going to work if the menu itself is displayed via a module. Some (many?) templates actually hard code the menu display code into the template rather than doing it with a module. So if you can turn the menu on and off by turning a module (probably a mod_mainmenu module) on and off, then you're ok, and can do it this way.

So, now what you do is set the "Menus" selector on both of the menus to "None". This is so that they don't show up unless/until MetaMod includes them.

Then create a MetaMod in the "user3" position, and make sure this one is published and assigned to the correct Menu(s). In the PHP box, type:

if (MM_LOGGED_IN) return XXX;
else return YYY;
// replace XXX with the module ID of the private menu, and YYY with the module ID of the  public menu.

A few other things to check:
1 - in the MetaMod, set the "show quick modules to" to "all"
2 - don't put anything in the "quick module id include" box.

That should now work smile

Having said that, there's now an easier way to achieve all this, and it's to use MetaTemplate. MetaTemplate has a way of removing menu items out of menus as a result of rules.

So these days I would do it this way:
1 - install MetaTemplate (free)
2 - create a new rule and name it
3 - in the Advanced PHP box, type the following:

if (MM_LOGGED_IN) return true;

4 - In the SUCCEED Action (box on the right), I would highlight the menu item that I wanted to remove in the "Unpublish Menus and Menu Items" box
5 - save the rule.

This way, you don't have to set up the whole duplicate menu and mess with different modules. As far as the rest of Joomla is concerned, that menu item simply disappears when someone is logged in, and it doesn't matter what method is used to display the menu, it just won't be there.


Hope one of these methods helps you,
regards,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Hide Menu from Registered Members of Joomla 1.5

How secure is this method?  Can a user gain unauthorised access/bypass the menu item by guessing the URL (Joomla core SEF or plain Joomla)?

For example, a menu item for staff members to update payment status in a database would best not be used by someone else for their own or others personal gain.

markg
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Hide Menu from Registered Members of Joomla 1.5

Hi Mark,

It's definitely not secure in the sense that you mean it - it's no replacement for actually requiring a login and checking the user id before allowing a certain action.

With the MetaMod solution you are simply hiding the display of a module - this in no way affects whether the target page is available or not if someone knows the URL.

With the MetaTemplate solution, this *can* actually affect the availability of the target page. It's quite complex to explain how this works, but if you're looking for security I wouldn't want to rely on this anyway. It would be far better to only allow the action itself (whatever that is) to take place for authenticated users, rather than just to prevent display of the page where the action can take place. Does that make sense?

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Hide Menu from Registered Members of Joomla 1.5

Thanks Stephen

So, if I had a menu that was 'hidden' and it was also set to Registered Users, then the exposure is limited to those logged on users guessing the URL.

If we captured the Joomla_user and also used this as a filter to validate/limit the authority of selected users to run certain scripts I think we should have sufficient security.

Cheers

Mark

markg
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Hide Menu from Registered Members of Joomla 1.5

markg wrote:

So, if I had a menu that was 'hidden' and it was also set to Registered Users, then the exposure is limited to those logged on users guessing the URL.

Agreed.

markg wrote:

If we captured the Joomla_user and also used this as a filter to validate/limit the authority of selected users to run certain scripts I think we should have sufficient security.

Yes, that should be fine.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1684
Total Polls:
6
Total Posts:
5940
Posts this week:
1
User Info:
 
Total Users:
5162
Newest User:
david30x73
Members Online:
0
Guests Online:
132

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked