I'd love for a future release to incorporate the ability to limit the number of groups a member can join. For now, I guess I'll have to hack it in...which I'd rather not do.
But I am stuck...
I assume that i have to edit the following file:
components/com_groupjive/gj/core/members.php
Particularly the function:
function activatemember()
[code:1]function activatemember( $groupid = null ) {
global $_CB_database, $Itemid, $_CB_framework, $gjConfig;
if ( ! $groupid ) {
$groupid = (int) cbGetParam( $_REQUEST, 'groupid', 0 );
}
if ( ! $_CB_framework->myId() ) {
HTML_wg::errorpage( GJ_NOTAUTH, null, $groupid, 'error' );
return;
}
$code = addslashes( cbGetParam( $_REQUEST, 'code', null ) );
$query = 'SELECT COUNT( ' . $_CB_database->NameQuote( 'id' ) . ' )'
. "\n FROM " . $_CB_database->NameQuote( '#__gj_active' )
. "\n WHERE " . $_CB_database->NameQuote( 'code' ) . " = " . $_CB_database->Quote( $code )
. "\n AND " . $_CB_database->NameQuote( 'too' ) . " = " . (int) $_CB_framework->myId()
. "\n AND " . $_CB_database->NameQuote( 'groups' ) . " = " . (int) $groupid;
$_CB_database->setQuery( $query );
$count = $_CB_database->loadResult();
if ( $_CB_database->getErrorNum() ) {
echo $_CB_database->stderr();
return;
}
if ( $count == 0 ) {
HTML_wg::errorpage( GJ_INVITE_NOT_EXIST, null, $groupid, 'error' );
return;
}
$query = 'UPDATE ' . $_CB_database->NameQuote( '#__gj_users' )
. "\n SET " . $_CB_database->NameQuote( 'status' ) . " = " . $_CB_database->Quote( 'active' )
. "\n WHERE " . $_CB_database->NameQuote( 'id_group' ) . " = " . (int) $groupid
. "\n AND " . $_CB_database->NameQuote( 'id_user' ) . " = " . (int) $_CB_framework->myId();
$_CB_database->setQuery( $query );
if ( ! $_CB_database->query() ) {
echo $_CB_database->stderr();
return;
}
$query = 'DELETE'
. "\n FROM " . $_CB_database->NameQuote( '#__gj_active' )
. "\n WHERE " . $_CB_database->NameQuote( 'code' ) . " = " . $_CB_database->Quote( $code )
. "\n AND " . $_CB_database->NameQuote( 'too' ) . " = " . $_CB_database->Quote( $_CB_framework->myUsername() );
$_CB_database->setQuery( $query );
if ( ! $_CB_database->query() ) {
echo $_CB_database->stderr();
return;
}
if ( $gjConfig ) {
$message = GJ_NEW_MEMBER;
$name = $_CB_framework->myUsername();
if ( $gjConfig ) {
$myId = $_CB_framework->myId();
if ( $myId ) {
$cbUser =& CBuser::getInstance( $myId );
if ( ! $cbUser ) {
$cbUser =& CBuser::getInstance( null );
}
$name = $cbUser->_cbuser->name;
}
}
notify( $groupid, $gjConfig, $message, $name );
}
$_CB_framework->redirect( 'index.php?option=com_groupjive&action=gj.core.groups.showgroup&groupid=' . $groupid . '&Itemid=' . $Itemid, GJ_WELCOME );
}[/code:1]
If anyone knows the code to add to this function to say: if(member belongs to another group) then error - it would be greatly appreciated!
P.S. if posting this question is a no-no, just let me know and I pre-apologize!