Private forums with GroupJive and Kunena
I’m currently building a multilingual health focused community site, FitTogether (note: at time of writing still under construction!). We’re using Joomla 1.5 along with a variety of third party components, including Community Builder, GroupJive and Kunena forum components. GroupJive allows you to create private and public groups that site members can create and join. It has the ability to send “bulletins” to group members, but no inbuilt discussion forum ability. That has been solved by integrating it with the Kunena forum component. But there’s a problem – neither Joomla 1.5 nor Kunena currently allow you to restrict access to forums to particular site members or groups of site members.
This functionality is planned with Joomla 1.6, but as is often the case, I needed a solution now. Fortunately I managed to come up with one and I thought I’d share it.
The solution uses Stephen Brandon’s powerful MetaMod module. MetaMod allows you to enable various “rules” on a Joomla page for turning modules on and off, writing particular messages, redirecting – whatever you can come up with. Using MetaMod I created a rule that checks to see if the logged on user is a member of the GroupJive group connected to the forum he/she is trying to view. If they are not then it redirects them to another page. It does the same if anyone attempts to view the parent category. This step isn’t necessary if the parent category is unpublished in Kunena.
To enable this solution, download and install MetaMod and publish it on the Kunena forum component page. In my template I publish it with no title, in the footer, and with class -nobox so that it’s effectively invisible to users. In the module itself I set the following PHP code -
//
// Block access to GroupJive Forums
//
$group_catid=21;
$redirect_url='/';
$catid = JRequest::getVar("catid");
//Redirect if in main group category
if ($catid==$group_catid)
{
$app->redirect($redirect_url);
}
// check if forum is in group category
$query="select parent from jos_fb_categories where id=".$catid;
$db->setQuery( $query, 0, 1 );
$row = $db->loadObject();
$parent_id= $row->parent;
if ($parent_id==$group_catid)
{
$username = $user->username;
$gj_query = "SELECT username FROM jos_gj_users
INNER JOIN jos_gj_jb ON jos_gj_users.id_group=jos_gj_jb.group_id
where category_id=".$catid." and username='".$username."'";
$db->setQuery( $gj_query, 0, 1 );
$gj_row = $db->loadObject();
$gj_username = $gj_row->username;
if (is_null($gj_username))
{
$app->redirect($redirect_url);
}
}
There are two things you need to change in the first few lines of code. $group_catid should be set to the Kunena category ID where your having GroupJive create forums. $redirect_url should be set to wherever you want the user to end up instead of the private forum. You may want to setup an error message page. In the future I think I’ll set mine to redirect to the main groupjive page with an error message stating the forums are private and they need to join. Alternatively I might simply redirect back to the page they came from. That’s it!



September 21st, 2009 at 11:31
Hello,
Thx for this workaround, but it’s not working for me. why?
My catid is 10 do i have to change something else?
September 21st, 2009 at 12:47
Is anything happening at all? First try using some of the simple metamod options without the code, just to ensure metamod is functioning.
October 3rd, 2009 at 17:26
How are the individual group forum areas created? As I see it, you created a parent category for GroupJive forums and then somehow the individual subs are created automatically. Is this correct?
Thanks and I look forward to testing it out once you reply.
October 4th, 2009 at 11:27
The individual groups are created automatically if you have the kunena plugin installed and configured in the groupjive backend. You just need to tell groupjive which category to create the forums in.
October 8th, 2009 at 04:15
Is groupjive still available? I’m getting errors trying to access groupjive.org. I found some releases at http://joomlacode.org/gf/project/groupjive/frs/ but the latest GroupJive is Beta2 dated 8/22/2007.
October 8th, 2009 at 20:21
Yup, the project has been taken over by joomlapolis, who do Community Builder – check out the joomlapolis forums for new
October 8th, 2009 at 22:09
Great thanks. I now have 1.8 Beta 4 from http://forge.joomlapolis.com/projects/list_files/groupjive.
December 22nd, 2009 at 00:46
Hi everyone
I’m looking to get my own website, and I’m just wondering if you have any advertice regarding the best hosting company…
Regarding my website stat:
300 Daily visitor
2 Domain
1 Data transfert needed
10 Bandwitch included
Many thanks for helping, any advice are welcome
January 4th, 2010 at 22:06
Hi,
I used to own a web hosting company myself but left that industry a year ago. I haven’t really checked out what everyone else is offering these days, but your setup will not require a particularly expensive account.