Skip to:
Content

BuddyPress.org

Ticket #3679: 3679.groups.01.diff

File 3679.groups.01.diff, 3.2 KB (added by cnorris23, 13 years ago)

Groups

  • bp-groups/bp-groups-template.php

     
    107107        var $sort_by;
    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 );
     110        function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $populate_extras, $include = false, $exclude = false, $show_hidden = false, $page_arg = 'grpage' ) {
     111                $this->__construct( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $include, $populate_extras, $exclude, $show_hidden, $page_arg );
    112112        }
    113113
    114         function __construct( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $populate_extras, $include = false, $exclude = false, $show_hidden = false ){
     114        function __construct( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $populate_extras, $include = false, $exclude = false, $show_hidden = false, $page_arg = 'grpage' ){
    115115
    116                 $this->pag_page = isset( $_REQUEST['grpage'] ) ? intval( $_REQUEST['grpage'] ) : $page;
     116                $this->pag_page = isset( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : $page;
    117117                $this->pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
    118118
    119119                if ( bp_current_user_can( 'bp_moderate' ) || ( is_user_logged_in() && $user_id == bp_loggedin_user_id() ) )
     
    170170                // Build pagination links
    171171                if ( (int) $this->total_group_count && (int) $this->pag_num ) {
    172172                        $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 ) ),
     173                                'base'      => add_query_arg( array( $page_arg => '%#%', 'num' => $this->pag_num, 's' => $search_terms, 'sortby' => $this->sort_by, 'order' => $this->order ) ),
    174174                                'format'    => '',
    175175                                'total'     => ceil( (int) $this->total_group_count / (int) $this->pag_num ),
    176176                                'current'   => $this->pag_page,
     
    265265                'max'             => false,
    266266                'show_hidden'     => false,
    267267
     268                'page_arg'        => 'grpage', // See https://buddypress.trac.wordpress.org/ticket/3679
     269
    268270                'user_id'         => $user_id, // Pass a user ID to limit to groups this user has joined
    269271                'slug'            => $slug,    // Pass a group slug to only return that group
    270272                'search_terms'    => '',       // Pass search terms to return only matching groups
     
    286288                        $search_terms = false;
    287289        }
    288290
    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 );
     291        $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 );
    290292        return apply_filters( 'bp_has_groups', $groups_template->has_groups(), $groups_template );
    291293}
    292294