WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: Aleph] users hardcoded at 15? (4 posts)

  1. julesallen
    Member
    Posted 5 years ago #

    Is there a way to bypass the hardcoded limit of 15 users per page? I tweaked UserQuery.php:

    $q['users_per_page'] = apply_filters('users_per_page', 15);

    to

    $q['users_per_page'] = apply_filters('users_per_page', 99);

    but it doesn't seem to make any difference at all. Where else should I go look for this?

    Thanks in advance.

  2. julesallen
    Member
    Posted 5 years ago #

    Apache was caching things, this does work. Shame to have to have this hardcoded, though.

  3. Detective
    Member
    Posted 5 years ago #

    Hi, it's not hardcoded because you can create a filter and change the value from another plugin or from your current template :) Just like this:

    function change_users_per_page($users) { return 99; }
    add_filter('users_per_page', 99);

    In this way, if you upgrade to the next version (currently in the works) you will not lose your changes.

    But I'm glad you got it working.

  4. calii
    Member
    Posted 5 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags