Skip to:
Content

BuddyPress.org

Changeset 8480


Ignore:
Timestamp:
06/07/2014 10:09:36 PM (10 years ago)
Author:
r-a-y
Message:

Groups widget: Set the per_page argument in bp_has_groups().

Previously, the per_page argument was not passed to bp_has_groups().
This meant that it wasn't possible to show more than twenty groups for the
groups widget. This commit addresses this.

Commit also switches the querystring to an array when setting up bp_has_groups().

Fixes #5695.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-widgets.php

    r8080 r8480  
    5959        $title = !empty( $instance['link_title'] ) ? '<a href="' . trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() ) . '">' . $title . '</a>' : $title;
    6060
    61         echo $before_title . $title . $after_title; ?>
    62 
    63         <?php if ( bp_has_groups( 'user_id=' . $user_id . '&type=' . $instance['group_default'] . '&max=' . $instance['max_groups'] ) ) : ?>
     61        echo $before_title . $title . $after_title;
     62
     63        $group_args = array(
     64            'user_id'         => $user_id,
     65            'type'            => $instance['group_default'],
     66            'per_page'        => $instance['max_groups'],
     67            'max'             => $instance['max_groups'],
     68        );
     69
     70        ?>
     71
     72        <?php if ( bp_has_groups( $group_args ) ) : ?>
    6473            <div class="item-options" id="groups-list-options">
    6574                <a href="<?php bp_groups_directory_permalink(); ?>" id="newest-groups"<?php if ( $instance['group_default'] == 'newest' ) : ?> class="selected"<?php endif; ?>><?php _e("Newest", 'buddypress') ?></a> |
Note: See TracChangeset for help on using the changeset viewer.