How to Exclude already friends in all members directory ?
-
Hey,
Is there any way to exclude already friends from members directory but keeping them in user’s friend list.Brajesh (buddydev) suggested me a code but that is excluding friends from a user’s friend list also due to which a user gets a error ‘sorry there is no member’. And I am not able to modify the code. I hope someone would help me.
This is the code:
add_filter( 'bp_after_has_members_parse_args', 'devb_custom_hide_friends' ); function devb_custom_hide_friends( $args ) { //do not hide friends in friend list if ( ! is_user_logged_in() || isset( $args['scope'] ) && $args['scope'] =='personal' ) { return $args; } $friends = friends_get_friend_user_ids( get_current_user_id() ); if ( empty( $friends ) ) { return $args; } $excluded = !empty( $args['exclude'] ) ? $args['exclude'] : array(); if (is_string( $excluded ) ) { $excluded = explode(',', $excluded ); } $excluded = array_merge( $friends, $excluded ); $args['exclude'] = $excluded; return $args; }
Please reply as soon as possible.
Thanks,
Nitin
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.