Exclude site admin

Home Forums BP Profile Search Forum Exclude site admin

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #10767 Reply
    John
    Guest

    Hi, is it possible to exclude the site admin from the user search results?

    Thanks

    John

    #10769 Reply
    andrea
    Keymaster

    Hi John,

    Do you want to show the admin in the directory but not in the search results, or exclude him/her from both?

    #10771 Reply
    John
    Guest

    Hi Andrea

    Exclude from both please.

    John

    #10772 Reply
    andrea
    Keymaster

    You can add this code to your bp-custom.php file:

    add_filter ('bp_ajax_querystring', 'exclude_user1', 20, 2);
    function exclude_user1 ($qs, $object)
    {
    	if ($object != 'members')  return $qs;
    
    	$args = wp_parse_args ($qs);
    
    	if (empty ($args['exclude']))
    		$args['exclude'] = '1';
    	else
    		$args['exclude'] .= ',1';
    
    	$qs = build_query ($args);
    	return $qs;
    }

    Please let me know if it works for you!

    #10773 Reply
    John
    Guest

    Hi Andrea

    Perfect – thank you.

    John

    #10775 Reply
    andrea
    Keymaster

    Great, I’m glad if I’ve been of help!

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Exclude site admin
Your information: