Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Check “If friends” to display data conditionally


Leia Scofield
Participant

@leiascofield

Not sure if this is the perfect way to do it, but here’s how I achieved what I was trying to do. This is in one of my templates:

<?php

global $bp, $friends_template;

$friend_status = friends_check_friendship_status( $bp->loggedin_user->id, $bp->displayed_user->id );

if ( $friend_status == ‘is_friend’ || $bp->loggedin_user->id == $bp->displayed_user->id ) {

?>

This checks to see if the user you’re looking at is a friend OR you, and then would display the information following it. You would then follow up with an else that shows the information non-friends see.

Skip to toolbar