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.

 

menu only for specyfic users

menu only for specyfic users

Hi there, I am not very good in php and I am not sure if there is possibility to do what i want. It looks like (this:

I have three users: eg user1 (id=1), user2(id=2), user 3(id=3)
and link in menu eg: gallery(id=63)

I mean:

Main menu:
-index
-gallery (id=63)
-contact
-info

I want only those three users be able to see "gallery" link in menu. I dont want any other users to have this gallery in theirs main menu. Can I do it with MetaMod? Could you, you kind people:) help me and give me php source with this solution or give me advices?

thanks!!!

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

Re: menu only for specyfic users

For *exactly* the functionality you are asking for, being able to control the visibility of a menu item based on a user group, you might want to search for JUGA (Joomla User Group Access). I think it's about $50, but included with the package is a replacement for mod_mainmenu which allows you to restrict particular items by group.

You can achieve something similar with MetaMod, but in a different way.

You would need to set up 2 separate menus, one with the gallery and one without the gallery. When setting up your second munu, it's best to make all the menu items into "aliases" of the menu items in the original menu, rather than brand new menu items. This is so that the URLs from the 2 menus are the same when using SEF URLs (otherwise, you'll get completely separate URLs depending on which menu is active).

Once you have the 2 menus, you have 2 separate "modules" that can be displayed in the module position.

Then, you set up a very basic rule in MetaMod to switch between the two modules depending on who's logged in:

if ($user->id == 1 or $user->id == 2 or $user->id == 3) return 101; /* module id for these users */
else return 102; /* module id for all other users */


replace 101 and 102 with the real module ids for the two menus.

Hope that helps,
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
3319 Posts
User info in posts
Administrator has disabled public posting

Re: menu only for specyfic users

Hi, I was about to tell it's perfectly working but... I have one big problem. If I make two different menu modules I need to keep them both turn on - in this case I can see in left collumn 'user menu' and 'user menu with gallery'. The perfect wayout would be if I can turn them both off and use the metod you told wrote in previous post so I can choose for wich users wich menu I want. If I turn both off and you metamod I have this "Error loading Modules"

Do you have any solution in mind? Thanks a lot:)

update1: oh man! I solved it! The solution is that it will work properly as you said and I wanted if I will set that both menu are turned on but menu assignment "none" smile Thanks for your help, it's very nice of you! smile

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

Board Info

Board Stats:
 
Total Topics:
1674
Total Polls:
6
Total Posts:
5917
Total Posts Today:
5
User Info:
 
Total Users:
11536
Newest User:
lucero1247
Members Online:
4
Guests Online:
149


Forum Legend:

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