Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/06/2012 07:15:09 AM (13 years ago)
Author:
djpaul
Message:

Allow pagination arguments for template loops to be renamed. Remove PHP4 constructors. Fixes #3679, props r-a-y and cnorris23

File:
1 edited

Legend:

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

    r5824 r5891  
    170170    var $total_member_count;
    171171
    172     function __construct( $type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras, $exclude, $meta_key, $meta_value ) {
    173 
    174         $this->pag_page = !empty( $_REQUEST['upage'] ) ? intval( $_REQUEST['upage'] ) : (int) $page_number;
     172    function __construct( $type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras, $exclude, $meta_key, $meta_value, $page_arg = 'upage' ) {
     173
     174        $this->pag_page = !empty( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : (int) $page_number;
    175175        $this->pag_num  = !empty( $_REQUEST['num'] )   ? intval( $_REQUEST['num'] )   : (int) $per_page;
    176176        $this->type     = $type;
     
    200200        if ( (int) $this->total_member_count && (int) $this->pag_num ) {
    201201            $this->pag_links = paginate_links( array(
    202                 'base'      => add_query_arg( 'upage', '%#%' ),
     202                'base'      => add_query_arg( $page_arg, '%#%' ),
    203203                'format'    => '',
    204204                'total'     => ceil( (int) $this->total_member_count / (int) $this->pag_num ),
     
    286286        'max'             => false,
    287287
     288        'page_arg'        => 'upage',       // See https://buddypress.trac.wordpress.org/ticket/3679
     289
    288290        'include'         => false,         // Pass a user_id or a list (comma-separated or array) of user_ids to only show these users
    289291        'exclude'         => false,         // Pass a user_id or a list (comma-separated or array) of user_ids to exclude these users
     
    317319        return false;
    318320
    319     $members_template = new BP_Core_Members_Template( $type, $page, $per_page, $max, $user_id, $search_terms, $include, (bool)$populate_extras, $exclude, $meta_key, $meta_value );
     321    $members_template = new BP_Core_Members_Template( $type, $page, $per_page, $max, $user_id, $search_terms, $include, (bool)$populate_extras, $exclude, $meta_key, $meta_value, $page_arg );
    320322    return apply_filters( 'bp_has_members', $members_template->has_members(), $members_template );
    321323}
     
    867869
    868870function bp_displayed_user_id() {
    869    
     871
    870872    static $id = 0;
    871    
     873
    872874    if ( empty( $id ) ) {
    873875        global $bp;
     
    881883
    882884    static $id = 0;
    883    
     885
    884886    if ( empty( $id ) ) {
    885887        global $bp;
Note: See TracChangeset for help on using the changeset viewer.