Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/17/2014 09:56:37 AM (10 years ago)
Author:
djpaul
Message:

Correctly generate pagination links when using AJAX and search terms have been set.
Also improve pagination support for main loops in the Groups/Members/Messages components when JS is disabled.

Fixes #5768, props r-a-y

File:
1 edited

Legend:

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

    r8826 r8931  
    235235        // Build pagination links
    236236        if ( (int) $this->total_group_count && (int) $this->pag_num ) {
     237            $pag_args = array(
     238                $page_arg => '%#%',
     239                'num'     => $this->pag_num,
     240                'sortby'  => $this->sort_by,
     241                'order'   => $this->order,
     242            );
     243
     244            if ( defined( 'DOING_AJAX' ) && true === (bool) DOING_AJAX ) {
     245                $base = remove_query_arg( 's', wp_get_referer() );
     246            } else {
     247                $base = '';
     248            }
     249
     250            if ( ! empty( $search_terms ) ) {
     251                $pag_args['s'] = $search_terms;
     252            }
     253
    237254            $this->pag_links = paginate_links( array(
    238                 'base'      => add_query_arg( array( $page_arg => '%#%', 'num' => $this->pag_num, 's' => $search_terms, 'sortby' => $this->sort_by, 'order' => $this->order ) ),
     255                'base'      => add_query_arg( $pag_args, $base ),
    239256                'format'    => '',
    240257                'total'     => ceil( (int) $this->total_group_count / (int) $this->pag_num ),
Note: See TracChangeset for help on using the changeset viewer.