Ticket #3679: 3679.groups.01.diff
File 3679.groups.01.diff, 3.2 KB (added by , 13 years ago) |
---|
-
bp-groups/bp-groups-template.php
107 107 var $sort_by; 108 108 var $order; 109 109 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 ); 112 112 } 113 113 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' ){ 115 115 116 $this->pag_page = isset( $_REQUEST[ 'grpage'] ) ? intval( $_REQUEST['grpage'] ) : $page;116 $this->pag_page = isset( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : $page; 117 117 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 118 118 119 119 if ( bp_current_user_can( 'bp_moderate' ) || ( is_user_logged_in() && $user_id == bp_loggedin_user_id() ) ) … … 170 170 // Build pagination links 171 171 if ( (int) $this->total_group_count && (int) $this->pag_num ) { 172 172 $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 ) ), 174 174 'format' => '', 175 175 'total' => ceil( (int) $this->total_group_count / (int) $this->pag_num ), 176 176 'current' => $this->pag_page, … … 265 265 'max' => false, 266 266 'show_hidden' => false, 267 267 268 'page_arg' => 'grpage', // See https://buddypress.trac.wordpress.org/ticket/3679 269 268 270 'user_id' => $user_id, // Pass a user ID to limit to groups this user has joined 269 271 'slug' => $slug, // Pass a group slug to only return that group 270 272 'search_terms' => '', // Pass search terms to return only matching groups … … 286 288 $search_terms = false; 287 289 } 288 290 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 ); 290 292 return apply_filters( 'bp_has_groups', $groups_template->has_groups(), $groups_template ); 291 293 } 292 294