Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Check “If friends” to display data conditionally

@ankurm

Member

This Would work….

`global $bp;
$loggedin_user_id = $bp->loggedin_user->userdata->ID;
$other_user_id = bp_get_member_user_id();
if($loggedin_user_id == $other_user_id){
$check_string = ‘its_me’ ;
}
else{
$check_string = friends_check_friendship_status( $loggedin_user_id,$other_user_id);
}
if ( $check_string == ‘is_friend’ ) {
/*Your Code Here*/
}
if ( $check_string == ‘not_friends’ ) {
/*Your Code Here*/
}
if ( $check_string == ‘pending’ ) {
/*Your Code Here*/
}
if ( $check_string == ‘its_me’ ) {
/*Your Code Here*/
}
?>`

You can also use this
$other_user_id = $bp->displayed_user->id ;
for the other user id

Skip to toolbar