BuddyDev

Search

[Resolved] BuddyPress Member Types Pro : Need help with Pagination

Tagged: 

  • Participant
    Level: Enlightened
    Posts: 35
    Mical Johnson on #28440

    The plugin is working great! But on the member type archives are not paginating. This may be my lack of knowledge, but when I limit the number of items in a page via the wp-admin dashboard (settings > Read …) it doesn’t seem to control the number of members shown in the user archive index page …

    For example, I have a member type called Athlete, and the member index file just keeps growing non-stop without showing any pagination. Even though, in the wp-admin it is set to show 5 items, which is followed by the blog posts index page. Any idea where I can go to limit the item numbers in BuddyPress or your plugin so that I can control the number of items per page?

    Also, keep in mind, I’ve customized the page quite a bit. So if you could guide me in the right direction (as you’ve done before) with some code example or functions to use, I’d appreciate it. Thanx in advance.

    On behalf of Mical
    Moose

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #28448

    Hi Moose,
    Thank you for the question. BuddyPress does not uses the settings under reading.

    By default, BuddyPress will list 20 members on a single page. You can change that by filtering on has_members as below.

    
    
    /**
     * Limit numbers of members per page.
     */
    add_filter( 'bp_after_has_members_parse_args', function ( $args ) {
    	$args['per_page'] = 5;// only show 5 members per page.
    
    	return $args;
    } );
    

    Hope that helps.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 35
    Mical Johnson on #28514

    THANKYOU VERY MUCH!! U DA BEST!!!

  • Participant
    Level: Initiated
    Posts: 11
    Derek Knox on #42474

    Out of interest, where did you put that code? Im trying to make BP list all members not 20 at a time so hoping this will do it.

    /**
    * Limit numbers of members per page.
    */
    add_filter( ‘bp_after_has_members_parse_args’, function ( $args ) {
    $args[‘per_page’] = 200;// show 200 members per page.

    return $args;
    } );

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #42490

    Hi Derek,
    The simple way to manage code is to use the code snippets plugin.

    https://wordpress.org/plugins/code-snippets/

    You may also put that code in your child theme’s functions.php.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved