Ticket #6506: 6506.03.patch
File 6506.03.patch, 2.3 KB (added by , 9 years ago) |
---|
-
src/bp-messages/bp-messages-screens.php
195 195 function messages_screen_notices() { 196 196 global $notice_id; 197 197 198 if ( !bp_current_user_can( 'bp_moderate' ) ) { 199 return false; 200 } 198 $notice_id = (int) bp_action_variable( 1 ); 201 199 202 $notice_id = (int)bp_action_variable( 1 );203 204 200 if ( !empty( $notice_id ) && is_numeric( $notice_id ) ) { 205 201 $notice = new BP_Messages_Notice( $notice_id ); 206 202 -
src/bp-messages/bp-messages-template.php
388 388 * } 389 389 * @return bool True if there are threads to display, otherwise false. 390 390 */ 391 function bp_has_message_threads( $args = '') {391 function bp_has_message_threads( $args = array() ) { 392 392 global $messages_template; 393 393 394 394 // The default box the user is looking at 395 if ( bp_is_current_action( 'sentbox' ) ) { 396 $default_box = 'sentbox'; 397 } elseif ( bp_is_current_action( 'notices' ) ) { 398 $default_box = 'notices'; 399 } else { 400 $default_box = 'inbox'; 395 $current_action = bp_current_action(); 396 switch ( $current_action ) { 397 case 'sentbox' : 398 case 'notices' : 399 case 'inbox' : 400 $default_box = $current_action; 401 break; 402 default : 403 $default_box = 'inbox'; 404 break; 401 405 } 402 406 407 // User ID 408 $user_id = bp_loggedin_user_id(); 409 410 // Search Terms 411 $search_terms = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; 412 403 413 // Parse the arguments 404 414 $r = bp_parse_args( $args, array( 405 'user_id' => bp_loggedin_user_id(),415 'user_id' => $user_id, 406 416 'box' => $default_box, 407 417 'per_page' => 10, 408 418 'max' => false, 409 419 'type' => 'all', 410 'search_terms' => isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '',420 'search_terms' => $search_terms, 411 421 'page_arg' => 'mpage', // See https://buddypress.trac.wordpress.org/ticket/3679 412 422 'meta_query' => array() 413 423 ), 'has_message_threads' ); 414 424 415 // If trying to access notices without capabilities, redirect to root domain416 if ( bp_is_current_action( 'notices' ) && !bp_current_user_can( 'bp_moderate' ) ) {417 bp_core_redirect( bp_displayed_user_domain() );418 }419 420 425 // Load the messages loop global up with messages 421 426 $messages_template = new BP_Messages_Box_Template( $r ); 422 427