Ticket #3679: 3679.blogs.01.diff
File 3679.blogs.01.diff, 3.1 KB (added by , 13 years ago) |
---|
-
bp-blogs/bp-blogs-template.php
102 102 var $pag_links; 103 103 var $total_blog_count; 104 104 105 function bp_blogs_template( $type, $page, $per_page, $max, $user_id, $search_terms ) {106 $this->__construct( $type, $page, $per_page, $max, $user_id, $search_terms );105 function bp_blogs_template( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg = 'bpage' ) { 106 $this->__construct( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg ); 107 107 } 108 108 109 function __construct( $type, $page, $per_page, $max, $user_id, $search_terms ) {109 function __construct( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg = 'bpage' ) { 110 110 111 $this->pag_page = isset( $_REQUEST[ 'bpage'] ) ? intval( $_REQUEST['bpage'] ) : $page;111 $this->pag_page = isset( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : $page; 112 112 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 113 113 114 114 if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] ) … … 135 135 136 136 if ( (int) $this->total_blog_count && (int) $this->pag_num ) { 137 137 $this->pag_links = paginate_links( array( 138 'base' => add_query_arg( 'bpage', '%#%' ),138 'base' => add_query_arg( $page_arg, '%#%' ), 139 139 'format' => '', 140 140 'total' => ceil( (int) $this->total_blog_count / (int) $this->pag_num ), 141 141 'current' => (int) $this->pag_page, … … 208 208 $user_id = 0; 209 209 $search_terms = null; 210 210 211 / * User filtering */211 // User filtering 212 212 if ( bp_displayed_user_id() ) 213 213 $user_id = bp_displayed_user_id(); 214 214 … … 218 218 'per_page' => 20, 219 219 'max' => false, 220 220 221 'user_id' => $user_id, // Pass a user_id to limit to only blogs this user has higher than subscriber access to 222 'search_terms' => $search_terms // Pass search terms to filter on the blog title or description. 221 'page_arg' => 'bpage', // See https://buddypress.trac.wordpress.org/ticket/3679 222 223 'user_id' => $user_id, // Pass a user_id to limit to only blogs this user has higher than subscriber access to 224 'search_terms' => $search_terms // Pass search terms to filter on the blog title or description. 223 225 ); 224 226 225 227 $r = wp_parse_args( $args, $defaults ); … … 238 240 } 239 241 } 240 242 241 $blogs_template = new BP_Blogs_Template( $type, $page, $per_page, $max, $user_id, $search_terms );243 $blogs_template = new BP_Blogs_Template( $type, $page, $per_page, $max, $user_id, $search_terms, $page_arg ); 242 244 return apply_filters( 'bp_has_blogs', $blogs_template->has_blogs(), $blogs_template ); 243 245 } 244 246 … … 279 281 } 280 282 function bp_get_blog_avatar( $args = '' ) { 281 283 global $blogs_template; 282 284 283 285 $defaults = array( 284 286 'type' => 'full', 285 287 'width' => false, … … 527 529 */ 528 530 function bp_blogs_get_subdomain_base() { 529 531 global $current_site; 530 532 531 533 return apply_filters( 'bp_blogs_subdomain_base', preg_replace( '|^www\.|', '', $current_site->domain ) . $current_site->path ); 532 534 } 533 535