• Resolved greendragontech

    (@greendragontech)


    I have non-admins doing light admin work with the help of user role editors. I would love for them to use this plugin like I can to mimic subscribers but found that my other workers can type in my name and gain admin access which I cannot allow. So, would it be possible to disable switching to admins of less than or not even finding admins in the search results?? Thanks in advance.

Viewing 1 replies (of 1 total)
  • Thread Starter greendragontech

    (@greendragontech)

    I figured it out. I changed the userswitcher.php file.
    Under the public function search_users( $input ) section, I simply added 'exclude' => array( 1 ) (the admin ID). To add more ID’s, use 'exclude' => array( 1 , 2, 3 ) as an example.

    So, this whole section looks like this:

    	public function search_users( $input ) {
    		$term = $input->term;
    		$per_page = 20;
    		$paged = ! empty( $input->page ) ? (int) $input->page : 1;
    		$offset = ( $paged - 1 ) * $per_page;
    		$exclude = array( $this->current_switcher_id );
    		$q = explode( ' ', $term );
    
    		$user_query = array(
    			'suppress_filters' => true,
    			'number' => $per_page,
    			'offset' => $offset,
    			'meta_query' => array(),
    			//'paged' => $paged,
    			'exclude' => $exclude,
                            'exclude' => array( 1 )
    		);
Viewing 1 replies (of 1 total)
  • The topic ‘Remove Admins from Search Results?’ is closed to new replies.