I'm very happy to say that Daniel rewrote the plugin - thanks, Daniel!! - so I didn't have to, and v1.8 now allows native Joomla use of the invitation-only system.
For info for anyone wanting to use this with JomSocial, I've implemented this with JomSocial as follows, primarily by bypassing JomSocial registration and using native Joomla registration:
1) Add a menu item pointing to Jomsocial – Home (the main activity page for Jomsocial)
Set the menu item access level to
registered (using Joomla ACL)
2) Use this as the redirect page for the Joomla login module if you want, so they are taken straight to the community page on login.
This means – users who are not logged in will not in general be able to reach the JomSocial front page (which has a big Register button for guests) via the menus.
They will have to use the native Joomla registration and login functionality and will then be redirected into JomSocial, which will become visible on the menu only after login (which changes the behaviour of the login module as it does in Joomla) so the registration button goes away.
There is a security exposure if someone browses directly to the JomSocial register URL (
www.yourdomain.com/?option=com_community&view=register). I’ve done a quick-and-dirty and trapped this in the Joomla plugin (file wmtracking.php) with a check for $option == com_community. I had to do this in two places – the if statement in function onAfterRoute() and then again in checkInviteCode().
In function onAfterRoute():
Change this:
$view = JRequest::getCmd('view');
if ( ($invitesonly == 1) && ($allowUserRegistration == 1) && ($option =='com_user') && ($view == 'register') ) //do Joomla registration processing
{
$this->checkInviteCode();
}
to this:
$view = JRequest::getCmd('view');
//change to show invite only if Jomsocial registration accessed via //direct url - Caroline 2010-09-05
if ( ($invitesonly == 1) && ($allowUserRegistration == 1) && ($option =='com_community') && ($view == 'register') ) //check for JomSocial direct url access
{
$this->checkInviteCode();
}
if ( ($invitesonly == 1) && ($allowUserRegistration == 1) && ($option =='com_user') && ($view == 'register') ) //do Joomla registration processing
{
$this->checkInviteCode();
}
and then in function checkInviteCode()
change this:
//Check for Option, Task, View and Parameter
if( !( $option=='com_user' && $view=='register' ) || ($user->get('id')) )
to this:
//Check for Option, Task, View and Parameter
if( !( ($option=='com_user' || $option=='com_community') && $view=='register' ) || ($user->get('id')) )
I think this means in theory that if someone a) gets an invitation and b) then registers by navigating directly to this link, they will be able to use JomSocial registration, which will then presumably break the tracking because it won’t trigger the code which handles the invitation, so I need to investigate this a bit further, and either find a way to switch JomSocial registration off completely or do a version of the plugin which handles the JomSocial events. But for now it’ll stop the trolls which is the main thing.
There may be other urls from which JomSocial registration can be accessed - I haven't exploited it that much yet so will no doubt come across more and will post on this thread as I find them. But this seems to be a good start.
It's quite easy to point the Jomsocial Invite Friends links at WM as follows:
Edit yourdomain.com/components/com_community/views/friends/view.html.php
function addSubMenu()
and change these lines:
$this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('CC CUSTOM SEARCH'));
$this->addSubmenuItem('index.php?option=com_community&view=friends&task=invite', JText::_('CC INVITE FRIENDS'));
to this (make sure the Itemid corresponds to the menu item on your site or leave it out):
$this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('CC CUSTOM SEARCH'));
//modify this to point to wmessenger
$this->addSubmenuItem('index.php?option=com_wmessengerpro&Itemid=76&view=wmessengerpro', JText::_('CC INVITE FRIENDS'));
//$this->addSubmenuItem('index.php?option=com_community&view=friends&task=invite', JText::_('CC INVITE FRIENDS'));
Then edit yourdomain.com/components/com_community/libraries/toolbar.php starting at about line 128 and change these lines:
$defaultCoreMenuArray['FRIEND_INVITE_FRIENDS'] = $this->_addDefaultItem( JText::_('CC INVITE FRIENDS'),
CRoute::_('index.php?option=com_community&view=friends&task=invite')
);
to this:
//removed to disable inviting friends via JomSocial
//$defaultCoreMenuArray['FRIEND_INVITE_FRIENDS'] = $this->_addDefaultItem(
// JText::_('CC INVITE FRIENDS'),
//CRoute::_('index.php?option=com_community&view=friends&task=invite')
//);
/* Change to route this to WMessenger Pro instead */
//removed to disable inviting friends via JomSocial
$defaultCoreMenuArray['FRIEND_INVITE_FRIENDS'] = $this->_addDefaultItem(
JText::_('CC INVITE FRIENDS'),
CRoute::_('index.php?option=com_wmessengerpro&Itemid=76&view=wmessengerpro')
);
/* end of change */
regards
Caroline