Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hi
    I’m using a function to separate contributors users from authors users, actually it works fine, but only give me 50 users.

    I figured out 50 was define in /wp-admin/includes/users.php but i don’t know how to modify this number, i’m pretty sure that this piece of code can help me, but i tried to put it in my plugin file or in my theme functions.php; nothing works…

    This is the script i use to separates users ID:

    function getAllUsersWithRole($role) {
    
    		$wp_user_search = new WP_User_Search($usersearch, $userspage, $role);
    		return $wp_user_search->get_results();
    
    	}
    
    	if ($_GET['users'] && $_GET['users'] == 'author') {
    
    		$IDs = getAllUsersWithRole('author');
    
    	} elseif ($_GET['users'] && $_GET['users'] == 'subscriber') {
    
    		$IDs = getAllUsersWithRole('subscriber');
    
    	} elseif ($_GET['users'] && $_GET['users'] == 'mix') {
    
    		$ID1s = getAllUsersWithRole('author');
    		$ID2s = getAllUsersWithRole('subscriber');
    
      		$IDs = array_merge ($ID1s, $ID2s);
    
    	} else {
    
    		$IDs = getAllUsersWithRole('subscriber');
    
    	}

    Any help is accepted, thanks

Viewing 1 replies (of 1 total)