Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Make Private Groups Invisible to none members

10 years 9 months ago
  • Melanie's Avatar
    Topic Author
  • Melanie
  • Offline
  • Fresh Boarder
  • Posts: 94
  • Thank you received: 2
Licenses:
JomSocial Active Socialize Expired

Hi,

I want to achieve the same as Stefan did in this thread:

www.jomsocial.com/forum/design-and-custo...om-list?limitstart=0

Our members will need to be able to create lots of private groups, for which they are responsible for inviting other members to join. Its impractical to have them all displaying in the main group listings as there will be thousands. I want them to be hidden to none group members, and Stefan's code changes seem to be what's needed. However, before I go ahead and mess with the file I have a couple of questions.

It isn't clear if Stefan added the new code to the file specified, or if he replaced a block of code with his reworked version.

The file he modified is: components/com_community/templates/default/groups.list.php

The code he provided is:

$user = CFactory::getUser();
$groupsUserIsIn = JAccess::getGroupsByUser(JFactory::getUser()->id);
if(in_array(7,$groupsUserIsIn) || in_array(8,$groupsUserIsIn))
{
	$isAdmin = true;
}else{
	$isAdmin = false;
}
?>
<a id="lists" name="listing"></a>
<div class="cLayout">
	<?php
	if( $groups )
	{
		$groupsModel =&  CFactory::getModel( 'groups' );
	?>
	<ul class="cIndexList forGroups cResetList">
	<?php		
		for( $i = 0; $i < count( $groups ); $i++ )
		{	
			$group	=& $groups[$i];	
			$isMember = $groupsModel->isMember( $user->id , $group->id );			
			if($isAdmin || $group->categoryid != 4 || ($group->categoryid == 6 && $isMember)){<?php
			}  <---
		}
	?>

Does that code effectively replace this block of code?:
$config	= CFactory::getConfig();
?>
<a id="lists" name="listing"></a>
<div class="cLayout">
	<?php
	if( $groups )
	{
	?>
	<ul class="cIndexList forGroups cResetList">
	<?php
		for( $i = 0; $i < count( $groups ); $i++ )
		{
			$group	=& $groups[$i];
	?>
		<li class="<?php echo $group->approvals == COMMUNITY_PRIVATE_GROUP?'group-private':'group-public'?>">
			<div class="cIndex-Box">
				<a href="<?php echo CRoute::_( 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id );?>" class="cIndex-Avatar cFloat-L">
					<img src="<?php echo $group->getThumbAvatar();?>" alt="<?php echo $this->escape($group->name); ?>" class="cAvatar" />
					<?php
					if($group->approvals == COMMUNITY_PRIVATE_GROUP)
					{
						echo '<b class="cStatus-Private">'.JText::_('COM_COMMUNITY_GROUPS_PRIVATE').'</b>';
					}
					?>
				</a>

				<div class="cIndex-Content">
					<h4 class="cIndex-Name cResetH">
						<a href="<?php echo CRoute::_( 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id );?>">
							<?php echo $this->escape($group->name); ?>
						</a>
					</h4>
					<div class="cIndex-Meta small"><?php echo JText::sprintf('COM_COMMUNITY_GROUPS_CREATE_TIME_ON' , JHTML::_('date', $group->created, JText::_('DATE_FORMAT_LC')) );?></div>
					<div class="cIndex-Status"><?php echo ($config->get('allowhtml')) ? $group->description : $this->escape($group->description); ?></div>

					<div class="cIndex-Actions clearfix">
						<div>
							<i class="com-icon-groups"></i>
							<a href="<?php echo CRoute::_( 'index.php?option=com_community&view=groups&task=viewmembers&groupid=' . $group->id ); ?>"><?php echo JText::sprintf((CStringHelper::isPlural($group->membercount)) ? 'COM_COMMUNITY_GROUPS_MEMBER_COUNT_MANY':'COM_COMMUNITY_GROUPS_MEMBER_COUNT', $group->membercount);?></a>
						</div>
						<?php if($config->get('creatediscussion') ){?>
						<div>
							<i class="com-icon-comment"></i>
							<?php echo JText::sprintf((CStringHelper::isPlural($group->discusscount)) ? 'COM_COMMUNITY_GROUPS_DISCUSSION_COUNT_MANY' :'COM_COMMUNITY_GROUPS_DISCUSSION_COUNT', $group->discusscount);?>
						</div>
						<?php }?>
						<div>
							<i class="com-icon-wall"></i>
							<?php echo JText::sprintf((CStringHelper::isPlural($group->wallcount)) ? 'COM_COMMUNITY_GROUPS_WALL_COUNT_MANY' : 'COM_COMMUNITY_GROUPS_WALL_COUNT', $group->wallcount);?>
						</div>
						<?php
						if( $isCommunityAdmin && $showFeatured )
						{
							if( !in_array($group->id, $featuredList) )
							{
						?>
						<div class="cIndex-Feature">
							<a onclick="joms.featured.add('<?php echo $group->id;?>','groups');"
							   href="javascript:void(0);"
							   class="btn Icon"
							   title="<?php echo JText::_('COM_COMMUNITY_MAKE_FEATURED'); ?>">

								<i class="com-icon-award-plus"></i>
							</a>
						</div>
						<?php
							}
						}
						?>

Kind regards,

Mel

p.s. it would be a good feature when creating a group, that we get the option to make it invisible to none members - so we could still display some private groups and not others. The same with any related events etc.

10 years 9 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

hi Melanie,

I need your conformation for this, so do you want the private groups will be hidden for the non-members of that group? in another words the private groups only will be shown for only that members?

Because the solution can be different than Stefan's issue

thank you

10 years 9 months ago
  • Melanie's Avatar
    Topic Author
  • Melanie
  • Offline
  • Fresh Boarder
  • Posts: 94
  • Thank you received: 2
Licenses:
JomSocial Active Socialize Expired

Hi Dimas,

yes, that exactly what I want to do, so that private groups are invisible to all but invited members.

Mel

10 years 9 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

Hi Mel,

Please you open again this file components/com_community/templates/default/groups.list.php, find this code :

$group	=& $groups[$i];

and change to :
$group	=& $groups[$i];
			$user = CFactory::getUser();
			$groupsModel =&  CFactory::getModel( 'groups' );
			$isMember = $groupsModel->isMember( $user->id , $group->id );
			if(!$isMember && $group->approvals == COMMUNITY_PRIVATE_GROUP) continue;

i hope it helps.

thank you

10 years 9 months ago
  • Melanie's Avatar
    Topic Author
  • Melanie
  • Offline
  • Fresh Boarder
  • Posts: 94
  • Thank you received: 2
Licenses:
JomSocial Active Socialize Expired

Dimas,

That works beautifully :)
Do you think this could be added as a feature in future releases (maybe as mentioned earlier with the option to make them invisible during group creation?).

Thanks so much for your help.

Mel

10 years 9 months ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

Hi Mel,

No it won't, I suggest you move your hack file to the override template folder, read here documentation.jomsocial.com/wiki/Customizing_Template

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW