Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hiding Administrators from Members Directories


  • manni65929
    Participant

    @manni65929

    Hey!

    Is there a way to hide Admins from the general member’s directory – maybe with a plugin or a shot script? Also, would that not be a great feature to be included in the next update for BuddyPress?

    Thanks in advance

Viewing 1 replies (of 1 total)

  • imranmd
    Participant

    @imranmd

    @manni65929 , try this

    add_action( 'bp_ajax_querystring', 'user_remove_mem_directory', 20, 2 );
    function user_remove_mem_directory( $query, $object ) {
    	if ( 'members' != $object ){
    		return $query;
    	}
    
    	$excluded_user = '1';// admin id to remove from the member directory
    
    	$args = wp_parse_args( $query );
    
    	if ( ! empty( $args['exclude'] ) ) {
    		$args['exclude'] = $args['exclude'] . ',' . $excluded_user;
    	} else {
    		$args['exclude'] = $excluded_user;
    	}
    
    	$query = build_query( $args );
    
    	return $query;
    
    }
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar