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.

Hide Add As Friend button

9 years 4 months ago
  • Rachel's Avatar
    Topic Author
  • Rachel
  • Offline
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 1
Licenses:
JomSocial Expired

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

9 years 4 months ago
Licenses:

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
						}
					}
					?>

ROOT/components/com_community/templates/default/groups.viewmembers.php

Remove:
<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>

ROOT/components/com_community/templates/default/events.viewguest.php

Remove code:
<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>


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
9 years 4 months ago
  • Rachel's Avatar
    Topic Author
  • Rachel
  • Offline
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 1
Licenses:
JomSocial Expired

Thanks for the quick reply :)

I think I didn't explain myself properly...

The button I meant is the one in the top header box on the profile page (see attached)

Which file to remove it from please?

Attachments:
9 years 4 months ago
Licenses:

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 ?>


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
9 years 4 months ago
  • Rachel's Avatar
    Topic Author
  • Rachel
  • Offline
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 1
Licenses:
JomSocial Expired

Great stuff - thanks :)

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