Ticket #3679: 3679.messages.01.diff
File 3679.messages.01.diff, 2.9 KB (added by , 13 years ago) |
---|
-
bp-messages/bp-messages-template.php
29 29 var $pag_links; 30 30 var $search_terms; 31 31 32 function bp_messages_box_template( $user_id, $box, $per_page, $max, $type ) {33 $this->__construct( $user_id, $box, $per_page, $max, $type );32 function bp_messages_box_template( $user_id, $box, $per_page, $max, $type, $search_terms, $page_arg = 'mpage' ) { 33 $this->__construct( $user_id, $box, $per_page, $max, $type, $search_terms, $page_arg ); 34 34 } 35 35 36 function __construct( $user_id, $box, $per_page, $max, $type, $search_terms ) {37 $this->pag_page = isset( $_GET[ 'mpage'] ) ? intval( $_GET['mpage'] ) : 1;36 function __construct( $user_id, $box, $per_page, $max, $type, $search_terms, $page_arg = 'mpage' ) { 37 $this->pag_page = isset( $_GET[$page_arg] ) ? intval( $_GET[$page_arg] ) : 1; 38 38 $this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : $per_page; 39 39 40 40 $this->user_id = $user_id; 41 41 $this->box = $box; 42 42 $this->type = $type; 43 43 $this->search_terms = $search_terms; 44 44 45 45 if ( 'notices' == $this->box ) { 46 46 $this->threads = BP_Messages_Notice::get_notices(); 47 47 } else { … … 78 78 79 79 if ( (int) $this->total_thread_count && (int) $this->pag_num ) { 80 80 $this->pag_links = paginate_links( array( 81 'base' => add_query_arg( 'mpage', '%#%' ),81 'base' => add_query_arg( $page_arg, '%#%' ), 82 82 'format' => '', 83 83 'total' => ceil( (int) $this->total_thread_count / (int) $this->pag_num ), 84 84 'current' => $this->pag_page, … … 175 175 'per_page' => 10, 176 176 'max' => false, 177 177 'type' => 'all', 178 'search_terms' => isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '' 178 'search_terms' => isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '', 179 'page_arg' => 'mpage', // See https://buddypress.trac.wordpress.org/ticket/3679 179 180 ); 180 181 181 182 $r = wp_parse_args( $args, $defaults ); … … 196 197 $box = 'notices'; 197 198 } 198 199 199 $messages_template = new BP_Messages_Box_Template( $user_id, $box, $per_page, $max, $type, $search_terms );200 $messages_template = new BP_Messages_Box_Template( $user_id, $box, $per_page, $max, $type, $search_terms, $page_arg ); 200 201 } 201 202 202 203 return apply_filters( 'bp_has_message_threads', $messages_template->has_threads(), $messages_template ); … … 322 323 } 323 324 function bp_get_message_thread_avatar() { 324 325 global $messages_template; 325 326 326 327 return apply_filters( 'bp_get_message_thread_avatar', bp_core_fetch_avatar( array( 'item_id' => $messages_template->thread->last_sender_id, 'type' => 'thumb', 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_core_get_user_displayname( $messages_template->thread->last_sender_id ) ) ) ) ); 327 328 } 328 329