Skip to:
Content

BuddyPress.org

Changeset 11346


Ignore:
Timestamp:
12/26/2016 10:55:17 PM (3 years ago)
Author:
slaffik
Message:

Administration: filter number of members in a list for group.

When editing a group in wp-admin area, we have 2 separate values that control the per page number of members (which should always be in sync). This commit adds a a new filter bp_groups_admin_members_type_per_page that gives ability to filter that number using only one add_filter().

See #7405.

File:
1 edited

Legend:

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

    r11305 r11346  
    878878            'group_role' => array( $type ),
    879879            'type'       => 'alphabetical',
    880             'per_page'   => 10,
     880            'per_page'   => apply_filters( 'bp_groups_admin_members_type_per_page', 10, $type ),
    881881            'page'       => $current_type_page,
    882882        ) );
     
    11321132
    11331133    // The key used to paginate this member type in the $_GET global.
    1134     $qs_key = $member_type . '_page';
     1134    $qs_key   = $member_type . '_page';
    11351135    $url_base = remove_query_arg( array( $qs_key, 'updated', 'success_modified' ), $_SERVER['REQUEST_URI'] );
    11361136
    1137     $page     = isset( $_GET[ $qs_key ] ) ? absint( $_GET[ $qs_key ] ) : 1;
    1138     $per_page = 10; // @todo Make this customizable?
     1137    $page = isset( $_GET[ $qs_key ] ) ? absint( $_GET[ $qs_key ] ) : 1;
     1138
     1139    /**
     1140     * Filters the number of members per member type that is displayed in group editing admin area.
     1141     *
     1142     * @since 2.8.0
     1143     *
     1144     * @param string $member_type Member type, which is a group role (admin, mod etc).
     1145     */
     1146    $per_page = apply_filters( 'bp_groups_admin_members_type_per_page', 10, $member_type );
    11391147
    11401148    // Don't show anything if there's no pagination.
     
    11591167    } else {
    11601168        $viewing_text = sprintf(
    1161             _n( 'Viewing %1$s - %2$s of %3$s member', 'Viewing %1$s - %2$s of %3$s members', $query->total_users, 'buddypress' ),
     1169            _nx( 'Viewing %1$s - %2$s of %3$s member', 'Viewing %1$s - %2$s of %3$s members', $query->total_users, 'Group members pagination in group admin', 'buddypress' ),
    11621170            bp_core_number_format( $current_page_start ),
    11631171            bp_core_number_format( $current_page_end ),
Note: See TracChangeset for help on using the changeset viewer.