Skip to:
Content

BuddyPress.org

Changeset 9260


Ignore:
Timestamp:
12/23/2014 01:00:46 AM (10 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

Location:
trunk/src
Files:
7 edited

Legend:

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

    r9259 r9260  
    315315                'prev_text' => _x( '←', 'Activity pagination previous text', 'buddypress' ),
    316316                'next_text' => _x( '→', 'Activity pagination next text', 'buddypress' ),
    317                 'mid_size'  => 1
     317                'mid_size'  => 1,
     318                'add_args'  => array(),
    318319            ) );
    319320        }
  • trunk/src/bp-blogs/bp-blogs-template.php

    r9218 r9260  
    249249                'prev_text' => _x( '←', 'Blog pagination previous text', 'buddypress' ),
    250250                'next_text' => _x( '→', 'Blog pagination next text',     'buddypress' ),
    251                 'mid_size'  => 1
     251                'mid_size'  => 1,
     252                'add_args'  => array(),
    252253            ) );
    253254        }
  • trunk/src/bp-forums/bp-forums-template.php

    r9037 r9260  
    296296                'prev_text' => _x( '←', 'Forum topic pagination previous text', 'buddypress' ),
    297297                'next_text' => _x( '→', 'Forum topic pagination next text', 'buddypress' ),
    298                 'mid_size'  => 1
     298                'mid_size'  => 1,
     299                'add_args'  => array(),
    299300            ) );
    300301        }
     
    568569                'prev_text' => _x( '←', 'Forum topic pagination previous text', 'buddypress' ),
    569570                'next_text' => _x( '→', 'Forum topic pagination next text', 'buddypress' ),
    570                 'mid_size'  => 1
     571                'mid_size'  => 1,
     572                'add_args'  => array(),
    571573            ) );
    572574
     
    17361738                'prev_text' => _x( '←', 'Forum thread pagination previous text', 'buddypress' ),
    17371739                'next_text' => _x( '→', 'Forum thread pagination next text', 'buddypress' ),
    1738                 'mid_size'  => 1
     1740                'mid_size'  => 1,
     1741                'add_args'  => array(),
    17391742            ) );
    17401743
  • 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 {
  • trunk/src/bp-members/bp-members-template.php

    r9210 r9260  
    276276            }
    277277
     278            /**
     279             * Defaults to an empty array to make sure paginate_links()
     280             * won't add the $page_arg to the links which would break
     281             * pagination in case javascript is disabled.
     282             */
     283            $add_args = array();
     284
    278285            if ( ! empty( $search_terms ) ) {
    279                 $pag_args['s'] = urlencode( $search_terms );
     286                $add_args['s'] = urlencode( $search_terms );
    280287            }
    281288
     
    287294                'prev_text' => _x( '←', 'Member pagination previous text', 'buddypress' ),
    288295                'next_text' => _x( '→', 'Member pagination next text', 'buddypress' ),
    289                 'mid_size'   => 1
     296                'mid_size'  => 1,
     297                'add_args'  => $add_args,
    290298            ) );
    291299        }
  • trunk/src/bp-messages/bp-messages-template.php

    r9240 r9260  
    184184            }
    185185
     186            $add_args = array();
     187
    186188            if ( ! empty( $this->search_terms ) ) {
    187                 $pag_args['s'] = $this->search_terms;
     189                $add_args['s'] = $this->search_terms;
    188190            }
    189191
     
    195197                'prev_text' => _x( '←', 'Message pagination previous text', 'buddypress' ),
    196198                'next_text' => _x( '→', 'Message pagination next text', 'buddypress' ),
    197                 'mid_size'  => 1
     199                'mid_size'  => 1,
     200                'add_args'  => $add_args,
    198201            ) );
    199202        }
  • trunk/src/bp-notifications/bp-notifications-template.php

    r9143 r9260  
    302302
    303303        if ( (int) $this->total_notification_count && (int) $this->pag_num ) {
     304            $add_args = array(
     305                'sort_order' => $this->sort_order,
     306            );
     307
    304308            $this->pag_links = paginate_links( array(
    305309                'base'      => add_query_arg( $this->page_arg, '%#%' ),
     
    310314                'next_text' => _x( '→', 'Notifications pagination next text',     'buddypress' ),
    311315                'mid_size'  => 1,
     316                'add_args'  => $add_args,
    312317            ) );
    313318
Note: See TracChangeset for help on using the changeset viewer.