Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/23/2014 01:00:46 AM (9 years ago)
Author:
imath
Message:

Make sure paginate links are correctly set in case javascript is disabled

Adding extra query arguments to the 'base' parameter of the paginate_links() function when javascript is disabled is preventing the loops to be correctly paginated. In this particular case, the pagination is 'stuck' on the second page. To be sure the pagination is correctly set, we need to pass extra query arguments using the 'add_args' parameter of the paginate_links() function.

Fixes #5967

File:
1 edited

Legend:

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

    r9221 r9260  
    311311        if ( (int) $this->total_group_count && (int) $this->pag_num ) {
    312312            $pag_args = array(
    313                 $page_arg => '%#%',
    314                 'num'     => $this->pag_num,
    315                 'sortby'  => $this->sort_by,
    316                 'order'   => $this->order,
     313                $page_arg => '%#%'
    317314            );
    318315
     
    323320            }
    324321
     322            $add_args = array(
     323                'num'     => $this->pag_num,
     324                'sortby'  => $this->sort_by,
     325                'order'   => $this->order,
     326            );
     327
    325328            if ( ! empty( $search_terms ) ) {
    326                 $pag_args['s'] = $search_terms;
     329                $add_args['s'] = urlencode( $search_terms );
    327330            }
    328331
     
    334337                'prev_text' => _x( '←', 'Group pagination previous text', 'buddypress' ),
    335338                'next_text' => _x( '→', 'Group pagination next text', 'buddypress' ),
    336                 'mid_size'  => 1
     339                'mid_size'  => 1,
     340                'add_args'  => $add_args,
    337341            ) );
    338342        }
     
    30393043
    30403044        $this->pag_links = paginate_links( array(
    3041             'base' => add_query_arg( array( 'mlpage' => '%#%' ), $base_url ),
    3042             'format' => '',
    3043             'total' => !empty( $this->pag_num ) ? ceil( $this->total_member_count / $this->pag_num ) : $this->total_member_count,
    3044             'current' => $this->pag_page,
     3045            'base'      => add_query_arg( array( 'mlpage' => '%#%' ), $base_url ),
     3046            'format'    => '',
     3047            'total'     => ! empty( $this->pag_num ) ? ceil( $this->total_member_count / $this->pag_num ) : $this->total_member_count,
     3048            'current'   => $this->pag_page,
    30453049            'prev_text' => '←',
    30463050            'next_text' => '→',
    3047             'mid_size' => 1
     3051            'mid_size'  => 1,
     3052            'add_args'  => array(),
    30483053        ));
    30493054    }
     
    40704075
    40714076        $this->pag_links = paginate_links( array(
    4072             'base' => add_query_arg( 'mrpage', '%#%' ),
    4073             'format' => '',
    4074             'total' => ceil( $this->total_request_count / $this->pag_num ),
    4075             'current' => $this->pag_page,
     4077            'base'      => add_query_arg( 'mrpage', '%#%' ),
     4078            'format'    => '',
     4079            'total'     => ceil( $this->total_request_count / $this->pag_num ),
     4080            'current'   => $this->pag_page,
    40764081            'prev_text' => '←',
    40774082            'next_text' => '→',
    4078             'mid_size' => 1
     4083            'mid_size'  => 1,
     4084            'add_args'  => array(),
    40794085        ) );
    40804086    }
     
    43224328                'next_text' => '→',
    43234329                'mid_size'  => 1,
     4330                'add_args'  => array(),
    43244331            ) );
    43254332        } else {
Note: See TracChangeset for help on using the changeset viewer.