When setting up a private group is there a way to restrict members (of that private group) from inviting others?
Hi, karl.
No, you can't disable ti via administration panel.
You may try to remove this button (if you're familiar with php) by editing this file:
ROOT/components/com_community/templates/default/groups.viewgroup.php
copy it to:
ROOT/templates/your-template/html/com_community (if you don't have "html" or "com_community" folders, feel free to create them)
replace (start from line 39):
<div class="span4 text-right">
<!-- invite friend button -->
<?php if($isMember) { ?>
<div class="btn btn-primary" onclick="joms.invitation.showForm(null,'groups,inviteUsers','<?php echo $group->id;?>',1,1)"><i class="js-icon-user-add"></i><?php echo JText::_('COM_COMMUNITY_INVITE_FRIENDS'); ?></div>
<?php } else { ?>
<div class="btn btn-primary" onclick="joms.groups.join(<?php echo $group->id;?>)"><i class="js-icon-user-add"></i><?php echo JText::_('COM_COMMUNITY_GROUPS_JOIN'); ?></div>
<?php }?>
</div>
<div class="span4 text-right">
<!-- invite friend button -->
<?php if($isMember AND !$isPrivate) { ?>
<div class="btn btn-primary" onclick="joms.invitation.showForm(null,'groups,inviteUsers','<?php echo $group->id;?>',1,1)"><i class="js-icon-user-add"></i><?php echo JText::_('COM_COMMUNITY_INVITE_FRIENDS'); ?></div>
<?php } elseif(!$isMember) { ?>
<div class="btn btn-primary" onclick="joms.groups.join(<?php echo $group->id;?>)"><i class="js-icon-user-add"></i><?php echo JText::_('COM_COMMUNITY_GROUPS_JOIN'); ?></div>
<?php }?>
</div>
<li><a tabindex="-1" href="javascript:void(0);" onclick="joms.invitation.showForm(null,'groups,inviteUsers','<?php echo $group->id;?>',1,1)"><?php echo JText::_('COM_COMMUNITY_INVITE_FRIENDS'); ?></a></li>
<?php if($isMember AND !$isPrivate) { ?>
<li><a tabindex="-1" href="javascript:void(0);" onclick="joms.invitation.showForm(null,'groups,inviteUsers','<?php echo $group->id;?>',1,1)"><?php echo JText::_('COM_COMMUNITY_INVITE_FRIENDS'); ?></a></li>
<?php } ?>
If you need more;
This hack will remove "Invite Friends" button in private groups for all users EXCEPT: group owner, Super User, Administrator:
ROOT/components/com_community/templates/default/groups.viewgroup.php
copy it to:
ROOT/templates/your-template/html/com_community (if you don't have "html" or "com_community" folders, feel free to create them)
replace (start from line 39):
<div class="span4 text-right">
<!-- invite friend button -->
<?php if($isMember) { ?>
<div class="btn btn-primary" onclick="joms.invitation.showForm(null,'groups,inviteUsers','<?php echo $group->id;?>',1,1)"><i class="js-icon-user-add"></i><?php echo JText::_('COM_COMMUNITY_INVITE_FRIENDS'); ?></div>
<?php } else { ?>
<div class="btn btn-primary" onclick="joms.groups.join(<?php echo $group->id;?>)"><i class="js-icon-user-add"></i><?php echo JText::_('COM_COMMUNITY_GROUPS_JOIN'); ?></div>
<?php }?>
</div>
<div class="span4 text-right">
<!-- invite friend button -->
<?php if($isMember AND !$isPrivate) { ?>
<div class="btn btn-primary" onclick="joms.invitation.showForm(null,'groups,inviteUsers','<?php echo $group->id;?>',1,1)"><i class="js-icon-user-add"></i><?php echo JText::_('COM_COMMUNITY_INVITE_FRIENDS'); ?></div>
<?php } elseif($isMine || $isSuperAdmin || $isAdmin AND $isPrivate) { ?>
<div class="btn btn-primary" onclick="joms.invitation.showForm(null,'groups,inviteUsers','<?php echo $group->id;?>',1,1)"><i class="js-icon-user-add"></i><?php echo JText::_('COM_COMMUNITY_INVITE_FRIENDS'); ?></div>
<?php } elseif(!$isMember) { ?>
<div class="btn btn-primary" onclick="joms.groups.join(<?php echo $group->id;?>)"><i class="js-icon-user-add"></i><?php echo JText::_('COM_COMMUNITY_GROUPS_JOIN'); ?></div>
<?php }?>
</div>
<li><a tabindex="-1" href="javascript:void(0);" onclick="joms.invitation.showForm(null,'groups,inviteUsers','<?php echo $group->id;?>',1,1)"><?php echo JText::_('COM_COMMUNITY_INVITE_FRIENDS'); ?></a></li>
<?php if($isMember AND !$isPrivate) { ?>
<li><a tabindex="-1" href="javascript:void(0);" onclick="joms.invitation.showForm(null,'groups,inviteUsers','<?php echo $group->id;?>',1,1)"><?php echo JText::_('COM_COMMUNITY_INVITE_FRIENDS'); ?></a></li>
<?php } elseif($isMine || $isSuperAdmin || $isAdmin AND $isPrivate) {?>
<?php if( $isMine || $isSuperAdmin || $isAdmin ){?>
<li><a tabindex="-1" href="javascript:void(0);" onclick="joms.invitation.showForm(null,'groups,inviteUsers','<?php echo $group->id;?>',1,1)"><?php echo JText::_('COM_COMMUNITY_INVITE_FRIENDS'); ?></a></li>
<?php }?>
hmm, I though it worked but now go this error when viewing a group:
Parse error: syntax error, unexpected '}' in /home/proutglo/public_html/resources/components/com_community/templates/default/groups.viewgroup.php on line 49
So I reverted it to the original.
Please advice.
Hi, Karl Johan.
It works 100%. :) You probably copied in wrong place, error says about missing }. Please try again.
question: should I edit this file as well or just copy it?
ROOT/components/com_community/templates/default/groups.viewgroup.php
Hi, Karl Johan.
ROOT/components/com_community/templates/default/groups.viewgroup.php
copy it to:
ROOT/templates/your-template/html/com_community (if you don't have "html" or "com_community" folders, feel free to create them)
I followed those instructions but the invite still shows up for regular members :-(
Hi, Karl.
I'm sorry to say that - it means that you did something wrong. It works perfectly form me and also I get feedback from other users that successfully implemented this hack on their sites.
In spare time I upload a demo file here.