Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Private Message Friends Only

@neijisly

Participant

Try to replace with this

function neiji_fillfield_only_if_friends() {
if( empty($_GET[‘r’] ) )

return;

if( is_super_admin() )

return;

$path = esc_url( $_SERVER[‘REQUEST_URI’] );

$redirect = bp_core_get_root_domain() . $_SERVER[‘REDIRECT_URL’];

preg_match(‘/[\?r] *= *[“\’]?([^”\’]*)[\&]/is’, $path, $match );

if( !empty( $match[1] ) ) {
$user_id = bp_core_get_userid( $match[1] );

if( ‘is_friend’ != friends_check_friendship_status( $user_id, bp_loggedin_user_id() ) )
bp_core_redirect( $redirect );

}

}

add_action( ‘messages_screen_compose’,’neiji_fillfield_only_if_friends’ );

Skip to toolbar