Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
J!1.6: Display a different module for each user group
J!1.6: Display a different module for each user group
Hey,
Thanks a lot for sharing this amazing tool! I've been very happy to use it on my J!1.5 site, and now I can finally use it on my J!1.6/1.7 site. Yay!
I run a membership site with several user groups:
-Public
-Registered
-Member
-Board member
-Employee
-Partner
-Sponsor
In the header, I want to display a different banner/image for each of these user groups.
I've accomplished the first two, but the "Member" banner won't show. The "Registered" banner is displayed to members also (and all the other self defined user groups). So, at this time my users can only be divided in "logged in" and "not logged in".
Any ideas what I can do to accomplish what I want?
These are the rules I use (found them in the recipes section):
Code:
if ( MM_NOT_LOGGED_IN ) return 44;
if ( MM_USER_REGISTERED ) return 46;
if ( $user->usertype == "My Special Group Name" ) return 54;
System: Joomla 1.6.5/MetaMod 3.1.
URL: http://www.norskgrunderforum.no/
General Secretary at Norsk Gründerforum (Norwegian Entrepreneur Forum), an entrepreneurial association with focus on innovation.
http://www.norskgrunderforum.no/
http://www.facebook.com/norskgrunderforum
Re: J!1.6: Display a different module for each user group
Hi Midnightman,
I suggest that you use the JomGenius syntax for doing this. I revamped it for the new J1.6 group memberships, and it seems to work nicely.
You should be able to do:
if ( MM_NOT_LOGGED_IN ) return 44;
if ($core_genius->check("groups = Public")) return 1;
if ($core_genius->check("groups = Registered")) return 2;
if ($core_genius->check("groups = Member")) return 3;
if ($core_genius->check("groups = Board Member")) return 4;
if ($core_genius->check("groups = Employee")) return 5;
if ($core_genius->check("groups = Partner")) return 6;
if ($core_genius->check("groups = Sponsor")) return 7;
Cheers,
Stephen
Re: J!1.6: Display a different module for each user group
Yes indeed, it works like a charm. Thanks a lot, Stephen! Amazing stuff!
I have to apologize for my late reply, it's because I've been on vacation.
Cheers!
General Secretary at Norsk Gründerforum (Norwegian Entrepreneur Forum), an entrepreneurial association with focus on innovation.
http://www.norskgrunderforum.no/
http://www.facebook.com/norskgrunderforum
Re: J!1.6: Display a different module for each user group
Just updated Joomla to 2.5.1 and MetaMod to 3.8, and it seems this recipe no longer work. Any ideas why?
General Secretary at Norsk Gründerforum (Norwegian Entrepreneur Forum), an entrepreneurial association with focus on innovation.
http://www.norskgrunderforum.no/
http://www.facebook.com/norskgrunderforum
Re: J!1.6: Display a different module for each user group
Re: J!1.6: Display a different module for each user group
Great, thx.
General Secretary at Norsk Gründerforum (Norwegian Entrepreneur Forum), an entrepreneurial association with focus on innovation.
http://www.norskgrunderforum.no/
http://www.facebook.com/norskgrunderforum
Re: J!1.6: Display a different module for each user group
Out of interest, do you also have Chameleon installed? The version of JomGenius in the current version of Chameleon is not up to date with the version in MetaMod 3.8, and the Chameleon version overrides the MM one in certain situations. Therefore, Chameleon can actually break MetaMod since it has an older version.
interested,
Stephen
Re: J!1.6: Display a different module for each user group
No, I don't have Chameleon. Thx for following up.
General Secretary at Norsk Gründerforum (Norwegian Entrepreneur Forum), an entrepreneurial association with focus on innovation.
http://www.norskgrunderforum.no/
http://www.facebook.com/norskgrunderforum
Re: J!1.6: Display a different module for each user group
Ok, 3.8 should really have this fixed (compared to 3.7).
Can you try the following code in the PHP box:
echo "Groups: ";
print_r($core_genius->info("groups"));
Then log in with a member of some of the different groups and see what it comes up with. If that doesn't work then there must be something else going on... but try that first.
Cheers,
Stephen
Re: J!1.6: Display a different module for each user group
I don't know PHP programming. Should I remove any of the old code? I tried pasting this code before the old code, with the following results:
When not logged in, this text:
Code:
Groups: Array ( )
displays over the module.
When logged in no module displays, and I get this text:
Code:
Groups: Array ( [0] => Member [1] => Superadmin [2] => Board Member [3] => Employee )
Yes, I belong to all 4 groups.
Additional info:
Before the upgrade, the only module (image) showing when I was logged in was the "Member" image. That was possibly not correct, but it was fine by me.
General Secretary at Norsk Gründerforum (Norwegian Entrepreneur Forum), an entrepreneurial association with focus on innovation.
http://www.norskgrunderforum.no/
http://www.facebook.com/norskgrunderforum
Board Info
- Board Stats:
- Total Topics:
- 1700
- Total Polls:
- 6
- Total Posts:
- 5967
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 8052
- Newest User:
- maarie443
- Members Online:
- 0
- Guests Online:
- 175
- 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