Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hide Logged in user on BuddyPress directory
add_filter('bp_ajax_querystring', 'devb_hide_user_on_directory', 15, 2);
function devb_hide_user_on_directory( $query_string, $object ){
if( !is_user_logged_in() )
return $query_string;
if( $object != 'members' || isset( $_REQUEST['search_terms'] ) && $_REQUEST['search_terms'] ) //updated to not hide from sarch
return $query_string;
if( ! bp_is_user() && bp_is_members_component() ){
$args = wp_parse_args( $query_string );
$args['exclude'] = array( 0 => get_current_user_id() );
$query_string = build_query( $args );
}
return $query_string;
}
@ask4eazy
Copy link

ask4eazy commented Jul 13, 2014

In which folder will i applied this file? will it be ok on function.php?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment