Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/21/2014 02:06:53 PM (10 years ago)
Author:
boonebgorges
Message:

Enable member sorting and pagination on group Members pages

Fixes #921

Props imath, boonebgorges

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-template.php

    r7948 r7949  
    20292029        $this->pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
    20302030
     2031        // Assemble the base URL for pagination
     2032        $base_url = trailingslashit( bp_get_group_permalink( groups_get_current_group() ) . bp_current_action() );
     2033        if ( bp_action_variable() ) {
     2034            $base_url = trailingslashit( $base_url . bp_action_variable() );
     2035        }
     2036
    20312037        $members_args = $r;
    20322038
     
    20532059
    20542060        $this->pag_links = paginate_links( array(
    2055             'base' => add_query_arg( 'mlpage', '%#%' ),
     2061            'base' => add_query_arg( array( 'mlpage' => '%#%' ), $base_url ),
    20562062            'format' => '',
    20572063            'total' => !empty( $this->pag_num ) ? ceil( $this->total_member_count / $this->pag_num ) : $this->total_member_count,
     
    21332139    global $members_template;
    21342140
     2141    $exclude_admins_mods = 1;
     2142
     2143    if ( bp_is_group_members() ) {
     2144        $exclude_admins_mods = 0;
     2145    }
     2146
    21352147    $r = wp_parse_args( $args, array(
    21362148        'group_id'            => bp_get_current_group_id(),
     
    21392151        'max'                 => false,
    21402152        'exclude'             => false,
    2141         'exclude_admins_mods' => 1,
     2153        'exclude_admins_mods' => $exclude_admins_mods,
    21422154        'exclude_banned'      => 1,
    21432155        'group_role'          => false,
     
    23252337    }
    23262338
     2339/**
     2340 * Output the Group members template
     2341 *
     2342 * @since BuddyPress (?)
     2343 *
     2344 * @return string html output
     2345 */
     2346function bp_groups_members_template_part() {
     2347    ?>
     2348    <div class="item-list-tabs" id="subnav" role="navigation">
     2349        <ul>
     2350            <li class="groups-members-search" role="search">
     2351                <?php bp_directory_members_search_form(); ?>
     2352            </li>
     2353
     2354            <?php bp_groups_members_filter(); ?>
     2355            <?php do_action( 'bp_members_directory_member_sub_types' ); ?>
     2356
     2357        </ul>
     2358    </div>
     2359
     2360    <div id="members-group-list" class="group_members dir-list">
     2361
     2362        <?php bp_get_template_part( 'groups/single/members' ); ?>
     2363
     2364    </div>
     2365    <?php
     2366}
     2367
     2368/**
     2369 * Output the Group members filters
     2370 *
     2371 * @since BuddyPress (?)
     2372 *
     2373 * @return string html output
     2374 */
     2375function bp_groups_members_filter() {
     2376    ?>
     2377    <li id="group_members-order-select" class="last filter">
     2378        <label for="group_members-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label>
     2379        <select id="group_members-order-by">
     2380            <option value="last_joined"><?php _e( 'Newest', 'buddypress' ); ?></option>
     2381            <option value="first_joined"><?php _e( 'Oldest', 'buddypress' ); ?></option>
     2382            <option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option>
     2383
     2384            <?php do_action( 'bp_groups_members_order_options' ); ?>
     2385
     2386        </select>
     2387    </li>
     2388    <?php
     2389}
    23272390
    23282391/***************************************************************************
Note: See TracChangeset for help on using the changeset viewer.