Hi
I have modified Jomsocial on my site so that everyone is everyone's friend by default. Therefore I don't need the 'Add as Friend' functionality at all. How do I hide this button?? Doesn't have to be removed from php files - if there's a way to hide it via CSS that's fine with me...
Thanks
Hi, Rachel.
Copy below files to: ROOT/templates/your-template/html/com_community (if you don't have "html" or "com_community" folders, feel free to create them)
ROOT/components/com_community/templates/default/people.browse.php
Remove:
<div>
<i class="com-icon-groups"></i>
<span><?php echo JText::sprintf( (CStringHelper::isPlural($row->friendsCount)) ? 'COM_COMMUNITY_FRIENDS_COUNT_MANY' : 'COM_COMMUNITY_FRIENDS_COUNT', $row->friendsCount);?></span>
</div>
<?php
if($row->addFriend)
{
$isWaitingApproval = CFriendsHelper::isWaitingApproval($my->id, $row->user->id);
?>
<div>
<?php if(isset($row->isMyFriend) && $row->isMyFriend==1){ ?>
<i class="com-icon-info"></i>
<a href="javascript:void(0)" onclick="joms.friends.connect('<?php echo $row->user->id;?>')"><span><?php echo JText::_('COM_COMMUNITY_PROFILE_PENDING_FRIEND_REQUEST'); ?></span></a>
<?php } else { ?>
<?php if(!$isWaitingApproval){?>
<i class="com-icon-user-plus"></i>
<a href="javascript:void(0)" onclick="joms.friends.connect('<?php echo $row->user->id;?>')"><span><?php echo JText::_('COM_COMMUNITY_PROFILE_ADD_AS_FRIEND'); ?></span></a>
<?php }else{ ?>
<i class="com-icon-info"></i> <span><?php echo JText::_('COM_COMMUNITY_PROFILE_PENDING_FRIEND_REQUEST'); ?></span>
<?php }?>
<?php } ?>
</div>
<?php
}
else
{
?>
<?php
if(($my->id != $row->user->id) && ($my->id !== 0))
{
?>
<div>
<i class="com-icon-tick"></i> <span><?php echo JText::_('COM_COMMUNITY_PROFILE_ADDED_AS_FRIEND'); ?></span>
</div>
<?php
}
}
?>
<li>
<i class="com-icon-groups"></i>
<a href="<?php echo CRoute::_('index.php?option=com_community&view=friends&userid=' . $member->id); ?>">
<?php echo JText::sprintf((CStringHelper::isPlural($member->friendsCount)) ? 'COM_COMMUNITY_FRIENDS_COUNT_MANY' : 'COM_COMMUNITY_FRIENDS_COUNT', $member->friendsCount); ?>
</a>
</li>
<div class="action">
<i class="com-icon-groups"></i>
<a href="<?php echo CRoute::_('index.php?option=com_community&view=friends&userid=' . $guest->id );?>">
<?php echo JText::sprintf( (CStringHelper::isPlural($guest->friendsCount)) ? 'COM_COMMUNITY_FRIENDS_COUNT_MANY' : 'COM_COMMUNITY_FRIENDS_COUNT' , $guest->friendsCount);?>
</a>
</div>
Hi, Rachel.
This button is not displayed if viewing user is a friend with currently displayed user :) At least it shouldn't be ;)
But still you may remove code that displays it. unfortunately it will be a core file hack:
ROOT/components/com_community/templates/default/modules/profile/userinfo.php
Remove this code:
<!-- Add as friend button -->
<?php if( !$isMine ): ?>
<?php if(!$isFriend && !$isMine && !$isBlocked): ?>
<?php if(!$isWaitingApproval):?>
<div class="btn btn-primary" onclick="joms.friends.connect('<?php echo $profile->id;?>')">
<span><?php echo JText::_('COM_COMMUNITY_PROFILE_ADD_AS_FRIEND'); ?></span>
</div>
<?php else : ?>
<div class="btn" onclick="joms.friends.connect('<?php echo $profile->id;?>')">
<span><?php echo JText::_('COM_COMMUNITY_PROFILE_PENDING_FRIEND_REQUEST'); ?></span>
</div>
<?php endif ?>
<?php endif; ?>
<?php endif ?>