Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Display alternate component menus
Display alternate component menus
Display alternate component menus
I have three levels of registered user - Registered, Subscriber and Member. When logged in Subscribers and Members see an alternative main navigation menu. That's fine.
However with some components the menu doesn't appear, so I am using metamod. But with UddeIM it still doesn't show.
I'm using this code:
if ( $option == "com_uddeim" && $user->usertype == "Registered" ) return 46; else return 63;
It doesn't work, even though this works fine for this code suing itemID:
if ($Itemid == "762" && $user->usertype == "Registered" ) return 46; else return 63;
If you want to check it out go to:
http://www.jaefiles.co.uk/LTWP
Login with u/n forum p/w forums. Then click on My Profile and then Messages>Send new message.
Thanks for any help.
James
Re: Display alternate component menus
Hi James,
yes, that's strange - what you wrote is supposed to work!
I wonder if $option is getting corrupted somewhere along the way... before the rule using $option, try putting the following:
$option = JRequest::getVar('option');
That could help. Let me know if it doesn't and I'll investigate further.
Cheers,
Stephen
Re: Display alternate component menus
Thanks Stephen - that works (nearly!)
Here's what I have now:
$option = JRequest::getVar('option');
if ( $option == "com_uddeim" && $user->usertype == "Registered" ) return 46; else return 63;
For some reason though, the else function doesn't seem to kick in. I thought I could just add another line with the alternative user group like so:
$option = JRequest::getVar('option');
if ( $option == "com_uddeim" && $user->usertype == "Subscriber" ) return 63;
But that doesn't seem to do anything - could this be anything to do with the non-standard user groups I have configured with JACL? If they are named, I wouldn't have thought so, but I don't know enough about it.
Thanks again.
James
Re: Display alternate component menus
Hi James,
it might be useful to put in the following rule for debugging purposes, just so you can see what groups etc show up when different people log in:
Code:
$option = JRequest::getVar('option');
echo "option = $option<br/>";
echo "usertype = " . $user->usertype . "<br/>";
Check the output of that with users from different groups logged in to the page. Then you'll know what to check for in the rules. Once you have that solved, the "else..." situation may become clearer.
Hope that helps,
Stephen
Re: Display alternate component menus
Hi Stephen,
unfortunately it doesn't reveal anything I didn't already know.
Here's the thing causing the problem, I think. I'm trying to show a main navigation menu depending on the class of user, so public and registered see one menu and subscribers and members another. They are both published in the same position but the members menu has access rights set in JACL, so it's access isn't set by Joomla core.
So menu 46 is public, but menu 63 is accesssed by members/subscribers.
So going through and trying each line of code individually (I'm sure there's probably a better, shorter way of doing it):
if ( $option == "com_finder" && $user->usertype == "" ) return 46;
if ( $option == "com_finder" && $user->usertype == "Registered" ) return 46;
if ( $option == "com_finder" && $user->usertype == "Subscriber" ) return 63;
if ( $option == "com_finder" && $user->usertype == "Member" ) return 63;
Now I know this works, because if I change the 63 to 46, the "public" menu appears, but it won't show the non-public one. Even if I create a new metaMod module, put the member-menu code in it and give the module restricted access right, it still doesn't appear.
I'm at a loss to get this to work, so any ideas on what I'm doing wrong would be appreciated.
Thanks,
James
Re: Display alternate component menus
ok, to summarize your situation, the rules are basically working except that module "63" does not show up even when the rules "succeed"?
In that case I'd look for things like:
1 - is module 63 published
2 - what are the user levels set in module 63? i.e. is it maybe set to a too-high user level restriction? Since you're only including it from this MetaMod you can probably set it to "Public" just in case that was the problem
3 - set your Joomla system error reporting to Full, just so you can see if there are any errors being reported. (that's in the system configuration)
If you just assign module 63 to a page in the normal way without a MetaMod involved, does it show up? If not, then that's why MetaMod can't display it either.
Hope that helps... this is puzzling!
Cheers,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » Display alternate component menus
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 7638
- Newest User:
- moner86658
- Members Online:
- 0
- Guests Online:
- 150
- 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