Re: Check “If friends” to display data conditionally
Even better!
Add this to your functions.php:
function bp_is_friend() {
global $bp;
if ( ‘is_friend’ == BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $bp->displayed_user->id ) )
return true;
return false;
}
Now you can drop bp_is_friend() in wherever you want to check if the displayed user is a friend of the logged in user, such as:
<?php if ( bp_is_friend() || bp_is_my_profile() ) { ?>
The above line checks if the displayed user is a friend or is the user.