Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Check “If friends” to display data conditionally


Leia Scofield
Participant

@leiascofield

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.

Skip to toolbar