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-groups/bp-groups-template.php

    r5758 r5891  
    108108    var $order;
    109109
    110     function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $populate_extras, $include = false, $exclude = false, $show_hidden = false ) {
    111         $this->__construct( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $include, $populate_extras, $exclude, $show_hidden );
    112     }
    113 
    114     function __construct( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $populate_extras, $include = false, $exclude = false, $show_hidden = false ){
    115 
    116         $this->pag_page = isset( $_REQUEST['grpage'] ) ? intval( $_REQUEST['grpage'] ) : $page;
     110    function __construct( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $populate_extras, $include = false, $exclude = false, $show_hidden = false, $page_arg = 'grpage' ){
     111
     112        $this->pag_page = isset( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : $page;
    117113        $this->pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
    118114
     
    171167        if ( (int) $this->total_group_count && (int) $this->pag_num ) {
    172168            $this->pag_links = paginate_links( array(
    173                 'base'      => add_query_arg( array( 'grpage' => '%#%', 'num' => $this->pag_num, 's' => $search_terms, 'sortby' => $this->sort_by, 'order' => $this->order ) ),
     169                'base'      => add_query_arg( array( $page_arg => '%#%', 'num' => $this->pag_num, 's' => $search_terms, 'sortby' => $this->sort_by, 'order' => $this->order ) ),
    174170                'format'    => '',
    175171                'total'     => ceil( (int) $this->total_group_count / (int) $this->pag_num ),
     
    266262        'show_hidden'     => false,
    267263
     264        'page_arg'        => 'grpage', // See https://buddypress.trac.wordpress.org/ticket/3679
     265
    268266        'user_id'         => $user_id, // Pass a user ID to limit to groups this user has joined
    269267        'slug'            => $slug,    // Pass a group slug to only return that group
     
    287285    }
    288286
    289     $groups_template = new BP_Groups_Template( (int) $user_id, $type, (int) $page, (int) $per_page, (int) $max, $slug, $search_terms, (bool)$populate_extras, $include, $exclude, $show_hidden );
     287    $groups_template = new BP_Groups_Template( (int) $user_id, $type, (int) $page, (int) $per_page, (int) $max, $slug, $search_terms, (bool)$populate_extras, $include, $exclude, $show_hidden, $page_arg );
    290288    return apply_filters( 'bp_has_groups', $groups_template->has_groups(), $groups_template );
    291289}
Note: See TracChangeset for help on using the changeset viewer.