Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Request for Recipe
Request for Recipe
Request for Recipe
Can someone help me with a recipe based on agora groups? I want to only show certain modules on a page to members of a certain group. Essentially I am trying to build what look like sub-front pages to my main page but each having data for their own group. I am sure there are easier ways to do this (and if there are please tell me as I have had no luck) but I would appreciate some help with this method.
I use Joomla 1.5.15
Metamod 2.0
Agora 3.0.06
Re: Request for Recipe
Hi Lazarus,
I am afraid I don't know of other ways to do what you are setting out to do - perhaps you could ask in the Agora forums?
I can however advise on the MetaMod solution. Here's some code which can identify which Agora groups the logged-in user is in. It doesn't distinguish exactly which page it's on inside Agora forums, as you didn't indicate exactly which page type you are going to use. Perhaps you could let me know which type you are after?
Code:
if ($option == 'com_agora') {
if ( $user->id > 0 ) {
$query = 'SELECT ug.group_id from #__agora_user_group ug, #__agora_users u
WHERE ug.user_id = u.id and u.jos_id = ' . (int)$user->id ;
$db->setQuery( $query );
$res = $db->loadResultArray();
$mods = array();
// is the user in group number WWW? if so add mod XXX
if ( array_search( WWW , $res) !== false ) $mods[] = XXX;
// is the user in group number YYY? if so add mod ZZZ
if ( array_search( YYY, $res) !== false ) $mods[] = ZZZ;
return $mods;
}
}
Replace WWW and YYY with the group id numbers that are going to see particular modules on this page. Replace XXX and ZZZ with the respective modules that should be displayed for these groups.
You're probably going to need to restrict these modules to a particular page on the Agora forum. To do this, change that first line:
if ($option == 'com_agora') {
If you want to restrict the modules to just the "forum" (ie. category list) pages, use:
if ($option == 'com_agora' and JRequest::getVar("task") == "forum") {
If you want to restrict the modules to pages displaying a thread in a topic, use:
if ($option == 'com_agora' and JRequest::getVar("task") == "topic") {
I hope that covers most bases. If you need any variation of these, please write back.
Cheers,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » Request for Recipe
Board Info
- Board Stats:
- Total Topics:
- 1698
- Total Polls:
- 6
- Total Posts:
- 5944
- Posts this week:
- 4
- User Info:
- Total Users:
- 5543
- Newest User:
- aj88
- Members Online:
- 0
- Guests Online:
- 112
- 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