Reply To: Friends only shortcode
<tumbleweed> 🙂
I figured out a solution. Probably not at all elegant but in case it’s of use the following creates a shortcode that can be used to show data to friends only using [isfriend]data[/isfriend]:
function isfriend( $atts, $content = null ) {
global $bp;
$is_friend = friends_check_friendship( $bp->loggedin_user->id, $bp->displayed_user->id );
$is_me = bp_is_my_profile();
if($is_friend or $is_me) {
return '<div class="right text">'.$content.'</div>';
}
}
add_shortcode("isfriend", "isfriend");