Hide Logged in user on BuddyPress directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In which folder will i applied this file? will it be ok on function.php?