Changeset 13096
- Timestamp:
- 08/26/2021 12:53:27 AM (3 years ago)
- Location:
- trunk/src/bp-messages
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/actions/bulk-delete.php
r11925 r13096 1 1 <?php 2 2 /** 3 * Messages: Bulk-delete action handler 3 * Messages: Bulk-delete action handler. 4 4 * 5 5 * @package BuddyPress … … 21 21 $thread_ids = $_POST['thread_ids']; 22 22 23 if ( ! $thread_ids || !messages_check_thread_access( $thread_ids ) ) {23 if ( ! $thread_ids || ! messages_check_thread_access( $thread_ids ) ) { 24 24 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) ); 25 25 } else { 26 if ( ! check_admin_referer( 'messages_delete_thread' ) ) {26 if ( ! check_admin_referer( 'messages_delete_thread' ) ) { 27 27 return false; 28 28 } 29 29 30 if ( ! messages_delete_thread( $thread_ids ) ) {31 bp_core_add_message( __( 'There was an error deleting messages.', 'buddypress'), 'error' );30 if ( ! messages_delete_thread( $thread_ids ) ) { 31 bp_core_add_message( __( 'There was an error deleting messages.', 'buddypress' ), 'error' ); 32 32 } else { 33 bp_core_add_message( __( 'Messages deleted.', 'buddypress') );33 bp_core_add_message( __( 'Messages deleted.', 'buddypress' ) ); 34 34 } 35 35 -
trunk/src/bp-messages/actions/bulk-manage-star.php
r12592 r13096 1 1 <?php 2 2 /** 3 * Messages: Bulk-manage star action handler 3 * Messages: Bulk-manage star action handler. 4 4 * 5 5 * @package BuddyPress -
trunk/src/bp-messages/actions/bulk-manage.php
r11925 r13096 1 1 <?php 2 2 /** 3 * Messages: Bulk-manage action handler 3 * Messages: Bulk-manage action handler. 4 4 * 5 5 * @package BuddyPress … … 25 25 $nonce = ! empty( $_POST['messages_bulk_nonce'] ) ? $_POST['messages_bulk_nonce'] : ''; 26 26 $messages = ! empty( $_POST['message_ids'] ) ? $_POST['message_ids'] : ''; 27 28 27 $messages = wp_parse_id_list( $messages ); 29 28 30 29 // Bail if no action or no IDs. 31 if ( ( ! in_array( $action, array( 'delete', 'read', 'unread' ) ) ) || empty( $messages ) || empty( $nonce ) ) {30 if ( ( ! in_array( $action, array( 'delete', 'read', 'unread' ), true ) ) || empty( $messages ) || empty( $nonce ) ) { 32 31 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' ); 33 32 } … … 48 47 // Delete, mark as read or unread depending on the user 'action'. 49 48 switch ( $action ) { 50 case 'delete' 49 case 'delete': 51 50 foreach ( $messages as $message ) { 52 51 messages_delete_thread( $message ); 53 52 } 54 53 bp_core_add_message( __( 'Messages deleted.', 'buddypress' ) ); 55 break;54 break; 56 55 57 case 'read' 56 case 'read': 58 57 foreach ( $messages as $message ) { 59 58 messages_mark_thread_read( $message ); 60 59 } 61 60 bp_core_add_message( __( 'Messages marked as read', 'buddypress' ) ); 62 break;61 break; 63 62 64 case 'unread' 63 case 'unread': 65 64 foreach ( $messages as $message ) { 66 65 messages_mark_thread_unread( $message ); 67 66 } 68 67 bp_core_add_message( __( 'Messages marked as unread.', 'buddypress' ) ); 69 break;68 break; 70 69 } 71 70 -
trunk/src/bp-messages/actions/compose.php
r11925 r13096 1 1 <?php 2 2 /** 3 * Messages: Compose action handler 3 * Messages: Compose action handler. 4 4 * 5 5 * @package BuddyPress … … 13 13 * @since 2.4.0 This function was split from messages_screen_compose(). See #6505. 14 14 * 15 * @return bool ean15 * @return bool 16 16 */ 17 17 function bp_messages_action_create_message() { … … 65 65 66 66 // Filter recipients into the format we need - array( 'username/userid', 'username/userid' ). 67 $autocomplete_recipients = (array) explode( ',', $_POST['send-to-input'] 67 $autocomplete_recipients = (array) explode( ',', $_POST['send-to-input'] ); 68 68 $typed_recipients = (array) explode( ' ', $_POST['send_to_usernames'] ); 69 69 $recipients = array_merge( $autocomplete_recipients, $typed_recipients ); … … 83 83 'subject' => $_POST['subject'], 84 84 'content' => $_POST['content'], 85 'error_type' => 'wp_error' 85 'error_type' => 'wp_error', 86 86 ) ); 87 87 -
trunk/src/bp-messages/actions/delete.php
r11925 r13096 1 1 <?php 2 2 /** 3 * Messages: Delete action handler 3 * Messages: Delete action handler. 4 4 * 5 5 * @package BuddyPress … … 21 21 $thread_id = bp_action_variable( 1 ); 22 22 23 if ( ! $thread_id || !is_numeric( $thread_id ) || !messages_check_thread_access( $thread_id ) ) {23 if ( ! $thread_id || ! is_numeric( $thread_id ) || ! messages_check_thread_access( $thread_id ) ) { 24 24 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) ); 25 25 } else { … … 29 29 30 30 // Delete message. 31 if ( ! messages_delete_thread( $thread_id ) ) {31 if ( ! messages_delete_thread( $thread_id ) ) { 32 32 bp_core_add_message( __('There was an error deleting that message.', 'buddypress'), 'error' ); 33 33 } else { -
trunk/src/bp-messages/actions/notices.php
r12990 r13096 1 1 <?php 2 2 /** 3 * Messages: Edit notice action handler 3 * Messages: Edit notice action handler. 4 4 * 5 5 * @package BuddyPress … … 13 13 * @since 2.4.0 This function was split from messages_screen_notices(). See #6505. 14 14 * 15 * @return bool ean15 * @return bool 16 16 */ 17 17 function bp_messages_action_edit_notice() { -
trunk/src/bp-messages/actions/read.php
r11925 r13096 1 1 <?php 2 2 /** 3 * Messages: Read action handler 3 * Messages: Read action handler. 4 4 * 5 5 * @package BuddyPress … … 13 13 * @since 2.2.0 14 14 * 15 * @return false|null Returns false on failure. Otherwise redirects back to the16 * 15 * @return bool Returns false on failure. Otherwise redirects back to the 16 * message box URL. 17 17 */ 18 18 function bp_messages_action_mark_read() { -
trunk/src/bp-messages/actions/star.php
r11925 r13096 1 1 <?php 2 2 /** 3 * Messages: Star action handler 3 * Messages: Star action handler. 4 4 * 5 5 * @package BuddyPress -
trunk/src/bp-messages/actions/unread.php
r11925 r13096 1 1 <?php 2 2 /** 3 * Messages: Unread action handler 3 * Messages: Unread action handler. 4 4 * 5 5 * @package BuddyPress … … 13 13 * @since 2.2.0 14 14 * 15 * @return false|null Returns false on failure. Otherwise redirects back to the16 * 15 * @return bool Returns false on failure. Otherwise redirects back to the 16 * message box URL. 17 17 */ 18 18 function bp_messages_action_mark_unread() { -
trunk/src/bp-messages/actions/view.php
r11925 r13096 1 1 <?php 2 2 /** 3 * Messages: View action handler 3 * Messages: View action handler. 4 4 * 5 5 * @package BuddyPress … … 10 10 /** 11 11 * Process a request to view a single message thread. 12 * 13 * @return bool False if not a single conversation. 12 14 */ 13 15 function messages_action_conversation() { -
trunk/src/bp-messages/bp-messages-admin.php
r11868 r13096 4 4 * 5 5 * @package BuddyPress 6 * @subpackage Messages 6 * @subpackage MessagesAdmin 7 7 * @since 3.0.0 8 8 */ … … 11 11 defined( 'ABSPATH' ) || exit; 12 12 13 // Load the Sitewide Notices Admin 13 // Load the Sitewide Notices Admin. 14 14 add_action( bp_core_admin_hook(), array( 'BP_Messages_Notices_Admin', 'register_notices_admin' ), 9 ); -
trunk/src/bp-messages/bp-messages-blocks.php
r13005 r13096 9 9 10 10 // Exit if accessed directly. 11 if ( ! defined( 'ABSPATH' ) ) { 12 exit; 13 } 11 defined( 'ABSPATH' ) || exit; 14 12 15 13 /** … … 19 17 * 20 18 * @param array $attributes The block attributes. 21 * @return string 19 * @return string HTML output. 22 20 */ 23 21 function bp_messages_render_sitewide_notices_block( $attributes = array() ) { -
trunk/src/bp-messages/bp-messages-cache.php
r11578 r13096 54 54 * @param BP_Messages_Message $message Message being saved. 55 55 */ 56 function bp_messages_clear_cache_on_message_save( BP_Messages_Message$message ) {56 function bp_messages_clear_cache_on_message_save( $message ) { 57 57 // Delete thread cache. 58 58 wp_cache_delete( $message->thread_id, 'bp_messages_threads' ); … … 79 79 function bp_messages_clear_cache_on_message_delete( $thread_ids, $user_id ) { 80 80 // Delete thread and thread recipient cache. 81 foreach ( (array) $thread_ids as $thread_id ) {81 foreach ( (array) $thread_ids as $thread_id ) { 82 82 wp_cache_delete( $thread_id, 'bp_messages_threads' ); 83 83 wp_cache_delete( "thread_recipients_{$thread_id}", 'bp_messages' ); … … 95 95 * 96 96 * @since 2.0.0 97 *98 * @param BP_Messages_Notice $notice Notice that was saved.99 97 */ 100 function bp_notices_clear_cache( $notice) {98 function bp_notices_clear_cache() { 101 99 wp_cache_delete( 'active_notice', 'bp_messages' ); 102 100 } 103 add_action( 'messages_notice_after_save', 101 add_action( 'messages_notice_after_save', 'bp_notices_clear_cache' ); 104 102 add_action( 'messages_notice_before_delete', 'bp_notices_clear_cache' ); -
trunk/src/bp-messages/bp-messages-functions.php
r12989 r13096 212 212 */ 213 213 function messages_send_notice( $subject, $message ) { 214 if ( !bp_current_user_can( 'bp_moderate' ) || empty( $subject ) || empty( $message ) ) { 214 215 if ( ! bp_current_user_can( 'bp_moderate' ) || empty( $subject ) || empty( $message ) ) { 215 216 return false; 216 217 // Has access to send notices, lets do it. 218 } else { 219 $notice = new BP_Messages_Notice; 220 $notice->subject = $subject; 221 $notice->message = $message; 222 $notice->date_sent = bp_core_current_time(); 223 $notice->is_active = 1; 224 $notice->save(); // Send it. 225 226 /** 227 * Fires after a notice has been successfully sent. 228 * 229 * @since 1.0.0 230 * 231 * @param string $subject Subject of the notice. 232 * @param string $message Content of the notice. 233 */ 234 do_action_ref_array( 'messages_send_notice', array( $subject, $message ) ); 235 236 return true; 237 } 217 } 218 219 $notice = new BP_Messages_Notice; 220 $notice->subject = $subject; 221 $notice->message = $message; 222 $notice->date_sent = bp_core_current_time(); 223 $notice->is_active = 1; 224 $notice->save(); // Send it. 225 226 /** 227 * Fires after a notice has been successfully sent. 228 * 229 * @since 1.0.0 230 * 231 * @param string $subject Subject of the notice. 232 * @param string $message Content of the notice. 233 * @param BP_Messages_Notice $notice Notice object sent. 234 */ 235 do_action_ref_array( 'messages_send_notice', array( $subject, $message, $notice ) ); 236 237 return true; 238 238 } 239 239 … … 276 276 $error = 0; 277 277 for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i ) { 278 if ( ! BP_Messages_Thread::delete( $thread_ids[ $i], $user_id ) ) {278 if ( ! BP_Messages_Thread::delete( $thread_ids[ $i ], $user_id ) ) { 279 279 $error = 1; 280 280 } … … 427 427 * @since 2.3.0 428 428 * 429 * @global BuddyPress $bp The one true BuddyPress instance. 430 * @global wpdb $wpdb WordPress database object. 431 * 429 432 * @param int $message_id ID of the message. 430 433 * @return int The ID of the thread if found, otherwise 0. … … 446 449 * 447 450 * @since 2.2.0 451 * 452 * @global wpdb $wpdb WordPress database object. 448 453 * 449 454 * @see delete_metadata() for full documentation excluding $meta_type variable. … … 579 584 580 585 // These should be extracted below. 581 $recipients = array(); 582 $email_subject = $email_content = ''; 583 $sender_id = 0; 586 $recipients = array(); 587 $sender_id = 0; 584 588 585 589 // Barf. … … 666 670 ); 667 671 } 668 669 $user_data_to_export = array();670 672 671 673 $user_threads = BP_Messages_Thread::get_current_threads_for_user( array( … … 717 719 ), 718 720 array( 719 'name' => __( 'Recipients', 'buddypress' ),721 'name' => __( 'Recipients', 'buddypress' ), 720 722 'value' => $recipients, 721 723 ), -
trunk/src/bp-messages/bp-messages-notifications.php
r13035 r13096 120 120 ); 121 121 122 // Custom notification action for the Messages component 122 // Custom notification action for the Messages component. 123 123 } else { 124 124 if ( 'string' === $format ) { … … 127 127 $retval = array( 128 128 'text' => $text, 129 'link' => $link 129 'link' => $link, 130 130 ); 131 131 } … … 216 216 * 217 217 * @since 1.9.0 218 * 219 * @global BP_Messages_Thread_Template $thread_template 218 220 */ 219 221 function bp_messages_screen_conversation_mark_notifications() { … … 309 311 <tr> 310 312 <th class="icon"></th> 311 <th class="title"><?php _e( 'Messages', 'buddypress' )?></th>312 <th class="yes"><?php _e( 'Yes', 'buddypress' )?></th>313 <th class="no"><?php _e( 'No', 'buddypress' )?></th>313 <th class="title"><?php esc_html_e( 'Messages', 'buddypress' ); ?></th> 314 <th class="yes"><?php esc_html_e( 'Yes', 'buddypress' ); ?></th> 315 <th class="no"><?php esc_html_e( 'No', 'buddypress' ); ?></th> 314 316 </tr> 315 317 </thead> … … 318 320 <tr id="messages-notification-settings-new-message"> 319 321 <td></td> 320 <td><?php _e( 'A member sends you a new message', 'buddypress' )?></td>322 <td><?php esc_html_e( 'A member sends you a new message', 'buddypress' ); ?></td> 321 323 <td class="yes"><input type="radio" name="notifications[notification_messages_new_message]" id="notification-messages-new-messages-yes" value="yes" <?php checked( $new_messages, 'yes', true ) ?>/><label for="notification-messages-new-messages-yes" class="bp-screen-reader-text"><?php 322 324 /* translators: accessibility text */ 323 _e( 'Yes, send email', 'buddypress' );325 esc_html_e( 'Yes, send email', 'buddypress' ); 324 326 ?></label></td> 325 327 <td class="no"><input type="radio" name="notifications[notification_messages_new_message]" id="notification-messages-new-messages-no" value="no" <?php checked( $new_messages, 'no', true ) ?>/><label for="notification-messages-new-messages-no" class="bp-screen-reader-text"><?php 326 328 /* translators: accessibility text */ 327 _e( 'No, do not send email', 'buddypress' );329 esc_html_e( 'No, do not send email', 'buddypress' ); 328 330 ?></label></td> 329 331 </tr> -
trunk/src/bp-messages/bp-messages-star.php
r12055 r13096 11 11 defined( 'ABSPATH' ) || exit; 12 12 13 /** UTILITY ************************************************************** /13 /** UTILITY ****************************************************************/ 14 14 15 15 /** … … 21 21 */ 22 22 function bp_get_messages_starred_slug() { 23 23 24 /** 24 25 * Filters the starred message slug. … … 51 52 $starred = array_flip( (array) bp_messages_get_meta( $mid, 'starred_by_user', false ) ); 52 53 53 if ( isset( $starred[$user_id] ) ) { 54 return true; 55 } else { 56 return false; 57 } 54 return isset( $starred[ $user_id ] ); 58 55 } 59 56 … … 256 253 'message_id' => 0, 257 254 'user_id' => bp_displayed_user_id(), 258 'bulk' => false 255 'bulk' => false, 259 256 ) ); 260 257 -
trunk/src/bp-messages/bp-messages-template.php
r12990 r13096 94 94 * Check whether there are more threads to iterate over. 95 95 * 96 * @global BP_Messages_Box_Template $messages_template 97 * 96 98 * @return bool 97 99 */ … … 104 106 * Set up the current thread inside the loop. 105 107 * 106 * @return object 108 * @global BP_Messages_Box_Template $messages_template 109 * 110 * @return BP_Messages_Thread 107 111 */ 108 112 function bp_message_thread() { … … 120 124 * Get the ID of the current thread in the loop. 121 125 * 126 * @global BP_Messages_Box_Template $messages_template 127 * 122 128 * @return int 123 129 */ … … 132 138 * @param int $thread_id ID of the current thread in the loop. 133 139 */ 134 return apply_filters( 'bp_get_message_thread_id', $messages_template->thread->thread_id );140 return apply_filters( 'bp_get_message_thread_id', (int) $messages_template->thread->thread_id ); 135 141 } 136 142 … … 144 150 * Get the subject of the current thread in the loop. 145 151 * 152 * @global BP_Messages_Box_Template $messages_template 153 * 146 154 * @return string 147 155 */ … … 168 176 * Generate an excerpt from the current message in the loop. 169 177 * 178 * @global BP_Messages_Box_Template $messages_template 179 * 170 180 * @return string 171 181 */ … … 208 218 * @since 2.0.0 209 219 * 220 * @global BP_Messages_Box_Template $messages_template 221 * 210 222 * @return string The raw content of the last message in the thread. 211 223 */ … … 232 244 * Get a link to the page of the current thread's last author. 233 245 * 246 * @global BP_Messages_Box_Template $messages_template 247 * 234 248 * @return string 235 249 */ … … 256 270 * Generate HTML links to the pages of the current thread's recipients. 257 271 * 272 * @global BP_Messages_Box_Template $messages_template 273 * 258 274 * @return string 259 275 */ … … 268 284 * @param string $value HTML links to the pages of the current thread's recipients. 269 285 */ 270 return apply_filters( 'bp_message_thread_to', BP_Messages_Thread::get_recipient_links( $messages_template->thread->recipients ) );286 return apply_filters( 'bp_message_thread_to', BP_Messages_Thread::get_recipient_links( $messages_template->thread->recipients ) ); 271 287 } 272 288 … … 288 304 * 289 305 * @since 2.9.0 Introduced `$user_id` parameter. 306 * 307 * @global BP_Messages_Box_Template $messages_template 290 308 * 291 309 * @param int $thread_id Optional. ID of the thread. Default: current … … 304 322 } 305 323 306 if ( null === $user_id) {324 if ( empty( $user_id ) ) { 307 325 $user_id = bp_loggedin_user_id(); 308 326 } … … 329 347 * @since 2.9.0 Introduced `$user_id` parameter. 330 348 * 331 * @param int $user_id Optional. ID of the user relative to whom the link332 * should be generated. Default: ID of logged-in user.349 * @param int|null $user_id Optional. ID of the user relative to whom the link 350 * should be generated. Default: ID of logged-in user. 333 351 */ 334 352 function bp_message_thread_delete_link( $user_id = null ) { … … 340 358 * @since 2.9.0 Introduced `$user_id` parameter. 341 359 * 342 * @param int $user_id Optional. ID of the user relative to whom the link 343 * should be generated. Default: ID of logged-in user. 360 * @global BP_Messages_Box_Template $messages_template 361 * 362 * @param int|null $user_id Optional. ID of the user relative to whom the link 363 * should be generated. Default: ID of logged-in user. 344 364 * @return string 345 365 */ … … 347 367 global $messages_template; 348 368 349 if ( null === $user_id) {369 if ( empty( $user_id ) ) { 350 370 $user_id = bp_loggedin_user_id(); 351 371 } … … 372 392 * @since 2.9.0 Introduced `$user_id` parameter. 373 393 * 374 * @param int $user_id Optional. ID of the user relative to whom the link375 * should be generated. Default: ID of logged-in user.394 * @param int|null $user_id Optional. ID of the user relative to whom the link 395 * should be generated. Default: ID of logged-in user. 376 396 */ 377 397 function bp_the_message_thread_mark_unread_url( $user_id = null ) { … … 384 404 * @since 2.9.0 Introduced `$user_id` parameter. 385 405 * 386 * @param int $user_id Optional. ID of the user relative to whom the link387 * should be generated. Default: ID of logged-in user.406 * @param int|null $user_id Optional. ID of the user relative to whom the link 407 * should be generated. Default: ID of logged-in user. 388 408 * @return string 389 409 */ … … 396 416 $args = array( 397 417 'action' => 'unread', 398 'message_id' => $id 418 'message_id' => $id, 399 419 ); 400 420 401 if ( null === $user_id) {421 if ( empty( $user_id ) ) { 402 422 $user_id = bp_loggedin_user_id(); 403 423 } … … 434 454 * @since 2.9.0 Introduced `$user_id` parameter. 435 455 * 436 * @param int $user_id Optional. ID of the user relative to whom the link437 * should be generated. Default: ID of logged-in user.456 * @param int|null $user_id Optional. ID of the user relative to whom the link 457 * should be generated. Default: ID of logged-in user. 438 458 */ 439 459 function bp_the_message_thread_mark_read_url( $user_id = null ) { … … 446 466 * @since 2.9.0 Introduced `$user_id` parameter. 447 467 * 448 * @param int $user_id Optional. ID of the user relative to whom the link449 * should be generated. Default: ID of logged-in user.468 * @param int|null $user_id Optional. ID of the user relative to whom the link 469 * should be generated. Default: ID of logged-in user. 450 470 * @return string 451 471 */ … … 458 478 $args = array( 459 479 'action' => 'read', 460 'message_id' => $id 480 'message_id' => $id, 461 481 ); 462 482 463 if ( null === $user_id) {483 if ( empty( $user_id ) ) { 464 484 $user_id = bp_loggedin_user_id(); 465 485 } … … 484 504 * @param int $user_id ID of the user relative to whom the link should be generated. 485 505 */ 486 return apply_filters( 'bp_get_the_message_thread_mark_read_url', $url );506 return apply_filters( 'bp_get_the_message_thread_mark_read_url', $url, $user_id ); 487 507 } 488 508 … … 496 516 * Generate the CSS class for the current thread. 497 517 * 518 * @global BP_Messages_Box_Template $messages_template 519 * 498 520 * @return string 499 521 */ … … 503 525 $class = false; 504 526 505 if ( $messages_template->current_thread % 2 == 1 ) {527 if ( $messages_template->current_thread % 2 === 1 ) { 506 528 $class .= 'alt'; 507 529 } … … 520 542 * Check whether the current thread has unread items. 521 543 * 544 * @global BP_Messages_Box_Template $messages_template 545 * 522 546 * @return bool True if there are unread items, otherwise false. 523 547 */ … … 525 549 global $messages_template; 526 550 527 $retval = ! empty( $messages_template->thread->unread_count ) 528 ? true 529 : false; 551 $retval = ! empty( $messages_template->thread->unread_count ); 530 552 531 553 /** … … 547 569 /** 548 570 * Get the current thread's unread count. 571 * 572 * @global BP_Messages_Box_Template $messages_template 549 573 * 550 574 * @return int … … 564 588 * @param int $count Current thread unread count. 565 589 */ 566 return apply_filters( 'bp_get_message_thread_unread_count', $count );590 return apply_filters( 'bp_get_message_thread_unread_count', (int) $count ); 567 591 } 568 592 … … 654 678 * Get the unformatted date of the last post in the current thread. 655 679 * 680 * @global BP_Messages_Box_Template $messages_template 681 * 656 682 * @return string 657 683 */ … … 707 733 * @see bp_core_fetch_avatar() For a description of arguments and 708 734 * return values. 735 * 736 * @global BP_Messages_Box_Template $messages_template 709 737 * 710 738 * @param array|string $args { … … 759 787 * Output the unread messages count for the current inbox. 760 788 * 761 * @since 2.6.x Added $user_id argument.789 * @since 2.6.x Added the `$user_id` paremeter. 762 790 * 763 791 * @param int $user_id The user ID. 764 *765 * @return int $unread_count Total inbox unread count for user.766 792 */ 767 793 function bp_total_unread_messages_count( $user_id = 0 ) { … … 771 797 * Get the unread messages count for the current inbox. 772 798 * 773 * @since 2.6.x Added $user_id argument.799 * @since 2.6.x Added the `$user_id` paremeter. 774 800 * 775 801 * @param int $user_id The user ID. … … 784 810 * @since 1.0.0 785 811 * 786 * @param int $value Unread messages count for the current inbox. 787 */ 788 return apply_filters( 'bp_get_total_unread_messages_count', BP_Messages_Thread::get_inbox_count( $user_id ) ); 812 * @param int $value Unread messages count for the current inbox. 813 * @param int $user_id ID of the user the messages are from. 814 */ 815 return apply_filters( 'bp_get_total_unread_messages_count', BP_Messages_Thread::get_inbox_count( $user_id ), $user_id ); 789 816 } 790 817 … … 798 825 * Get the pagination HTML for the current thread loop. 799 826 * 827 * @global BP_Messages_Box_Template $messages_template 828 * 800 829 * @return string 801 830 */ … … 815 844 /** 816 845 * Generate the "Viewing message x to y (of z messages)" string for a loop. 846 * 847 * @global BP_Messages_Box_Template $messages_template 817 848 */ 818 849 function bp_messages_pagination_count() { … … 1058 1089 * @since 1.6.0 1059 1090 * 1091 * @global BP_Messages_Box_Template $messages_template 1092 * 1060 1093 * @return bool 1061 1094 */ … … 1084 1117 * @since 1.0.0 1085 1118 * @deprecated 1.6.0 1086 * @return bool1087 1119 */ 1088 1120 function bp_message_is_active_notice() { … … 1112 1144 */ 1113 1145 function bp_message_notice_id() { 1114 echo (int)bp_get_message_notice_id();1146 echo bp_get_message_notice_id(); 1115 1147 } 1116 1148 /** 1117 1149 * Get the ID of the current notice in the loop. 1150 * 1151 * @global BP_Messages_Box_Template $messages_template 1118 1152 * 1119 1153 * @return int … … 1129 1163 * @param int $id ID of the current notice in the loop. 1130 1164 */ 1131 return apply_filters( 'bp_get_message_notice_id', $messages_template->thread->id );1165 return apply_filters( 'bp_get_message_notice_id', (int) $messages_template->thread->id ); 1132 1166 } 1133 1167 … … 1141 1175 * Get the post date of the current notice in the loop. 1142 1176 * 1177 * @global BP_Messages_Box_Template $messages_template 1178 * 1143 1179 * @return string 1144 1180 */ … … 1171 1207 * @since 5.0.0 The $notice parameter has been added. 1172 1208 * 1173 * @param BP_Messages_Notice $notice The notice object. 1209 * @global BP_Messages_Box_Template $messages_template 1210 * 1211 * @param BP_Messages_Notice|null $notice The notice object. 1174 1212 * @return string 1175 1213 */ … … 1206 1244 * @since 5.0.0 The $notice parameter has been added. 1207 1245 * 1208 * @param BP_Messages_Notice $notice The notice object. 1246 * @global BP_Messages_Box_Template $messages_template 1247 * 1248 * @param BP_Messages_Notice|null $notice The notice object. 1209 1249 * @return string 1210 1250 */ … … 1235 1275 * Get the URL for deleting the current notice. 1236 1276 * 1277 * @global BP_Messages_Box_Template $messages_template 1278 * 1237 1279 * @return string Delete URL. 1238 1280 */ … … 1259 1301 /** 1260 1302 * Get the URL for deactivating the current notice. 1303 * 1304 * @global BP_Messages_Box_Template $messages_template 1261 1305 * 1262 1306 * @return string … … 1290 1334 * Generate the text ('Deactivate' or 'Activate') for the notice action link. 1291 1335 * 1336 * @global BP_Messages_Box_Template $messages_template 1337 * 1292 1338 * @return string 1293 1339 */ … … 1315 1361 * 1316 1362 * @since 9.0.0 1317 * @return string URL for dismissing the current notice for the current user.1318 1363 */ 1319 1364 function bp_message_notice_dismiss_link() { … … 1385 1430 1386 1431 if ( is_array( $closed_notices ) ) { 1387 if ( ! in_array( $notice->id, $closed_notices) && $notice->id ) {1432 if ( ! in_array( $notice->id, $closed_notices, true ) && $notice->id ) { 1388 1433 ?> 1389 1434 <div id="message" class="info notice" rel="n-<?php echo esc_attr( $notice->id ); ?>"> … … 1577 1622 * Initialize the messages template loop for a specific thread. 1578 1623 * 1624 * @global BP_Messages_Thread_Template $thread_template 1625 * 1579 1626 * @param array|string $args { 1580 1627 * Array of arguments. All are optional. … … 1619 1666 * Get the 'ASC' or 'DESC' messages order string for this loop. 1620 1667 * 1668 * @global BP_Messages_Thread_Template $thread_template 1669 * 1621 1670 * @return string 1622 1671 */ 1623 1672 function bp_get_thread_messages_order() { 1624 1673 global $thread_template; 1674 1625 1675 return $thread_template->thread->messages_order; 1626 1676 } … … 1628 1678 /** 1629 1679 * Check whether there are more messages to iterate over. 1680 * 1681 * @global BP_Messages_Thread_Template $thread_template 1630 1682 * 1631 1683 * @return bool … … 1640 1692 * Set up the current thread inside the loop. 1641 1693 * 1642 * @return object 1694 * @global BP_Messages_Thread_Template $thread_template 1695 * 1696 * @return BP_Messages_Message 1643 1697 */ 1644 1698 function bp_thread_the_message() { … … 1657 1711 * Get the ID of the thread that the current loop belongs to. 1658 1712 * 1713 * @global BP_Messages_Thread_Template $thread_template 1714 * 1659 1715 * @return int 1660 1716 */ … … 1680 1736 /** 1681 1737 * Get the subject of the thread currently being iterated over. 1738 * 1739 * @global BP_Messages_Thread_Template $thread_template 1682 1740 * 1683 1741 * @return string … … 1713 1771 } 1714 1772 1773 /** 1774 * Filters the thread recipients. 1775 * 1776 * @since 10.0.0 1777 * 1778 * @param string $recipients List of thread recipients. 1779 */ 1715 1780 return apply_filters( 'bp_get_the_thread_recipients', $recipients ); 1716 1781 } … … 1720 1785 * 1721 1786 * @since 2.2.0 1787 * 1788 * @global BP_Messages_Thread_Template $thread_template 1722 1789 * 1723 1790 * @return int … … 1725 1792 function bp_get_thread_recipients_count() { 1726 1793 global $thread_template; 1794 1727 1795 /** 1728 1796 * Filters the total number of recipients in a thread. … … 1765 1833 * 1766 1834 * @since 2.2.0 1835 * 1836 * @global BP_Messages_Thread_Template $thread_template 1767 1837 * 1768 1838 * @return string … … 1806 1876 */ 1807 1877 function bp_the_thread_message_id() { 1808 echo (int)bp_get_the_thread_message_id();1878 echo bp_get_the_thread_message_id(); 1809 1879 } 1810 1880 /** … … 1812 1882 * 1813 1883 * @since 1.9.0 1884 * 1885 * @global BP_Messages_Thread_Template $thread_template 1814 1886 * 1815 1887 * @return int … … 1820 1892 $thread_message_id = isset( $thread_template->message->id ) 1821 1893 ? (int) $thread_template->message->id 1822 : null;1894 : 0; 1823 1895 1824 1896 /** … … 1829 1901 * @param int $thread_message_id ID of the current message in the thread. 1830 1902 */ 1831 return apply_filters( 'bp_get_the_thread_message_id',$thread_message_id );1903 return (int) apply_filters( 'bp_get_the_thread_message_id', (int) $thread_message_id ); 1832 1904 } 1833 1905 … … 1845 1917 * @since 2.1.0 1846 1918 * 1919 * @global BP_Messages_Thread_Template $thread_template 1920 * 1847 1921 * @return string 1848 1922 */ … … 1859 1933 1860 1934 // Whether the sender is the same as the logged-in user. 1861 if ( bp_loggedin_user_id() == $thread_template->message->sender_id ) {1935 if ( bp_loggedin_user_id() === $thread_template->message->sender_id ) { 1862 1936 $classes[] = 'sent-by-me'; 1863 1937 } … … 1884 1958 * Get the CSS class used for message zebra striping. 1885 1959 * 1960 * @global BP_Messages_Thread_Template $thread_template 1961 * 1886 1962 * @return string 1887 1963 */ … … 1889 1965 global $thread_template; 1890 1966 1891 if ( $thread_template->current_message % 2 == 1 ) { 1967 $class = 'odd'; 1968 if ( 1 === $thread_template->current_message % 2 ) { 1892 1969 $class = 'even alt'; 1893 } else {1894 $class = 'odd';1895 1970 } 1896 1971 … … 1911 1986 */ 1912 1987 function bp_the_thread_message_sender_id() { 1913 echo (int)bp_get_the_thread_message_sender_id();1988 echo bp_get_the_thread_message_sender_id(); 1914 1989 } 1915 1990 /** … … 1917 1992 * 1918 1993 * @since 2.1.0 1994 * 1995 * @global BP_Messages_Thread_Template $thread_template 1919 1996 * 1920 1997 * @return int … … 1948 2025 /** 1949 2026 * Get the avatar for the current message sender. 2027 * 2028 * @global BP_Messages_Thread_Template $thread_template 1950 2029 * 1951 2030 * @param array|string $args { … … 1998 2077 * @since 1.1.0 1999 2078 * 2079 * @global BP_Messages_Thread_Template $thread_template 2080 * 2000 2081 * @return string 2001 2082 */ … … 2025 2106 * 2026 2107 * @since 1.1.0 2108 * 2109 * @global BP_Messages_Thread_Template $thread_template 2027 2110 * 2028 2111 * @return string … … 2122 2205 * @since 2.1.0 2123 2206 * 2207 * @global BP_Messages_Thread_Template $thread_template 2124 2208 * 2125 2209 * @return int … … 2150 2234 * 2151 2235 * @since 1.1.0 2236 * 2237 * @global BP_Messages_Thread_Template $thread_template 2152 2238 * 2153 2239 * @return string … … 2183 2269 */ 2184 2270 function bp_messages_embed() { 2185 add_filter( 'embed_post_id', 2186 add_filter( 'bp_embed_get_cache', 'bp_embed_message_cache',10, 3 );2271 add_filter( 'embed_post_id', 'bp_get_the_thread_message_id' ); 2272 add_filter( 'bp_embed_get_cache', 'bp_embed_message_cache', 10, 3 ); 2187 2273 add_action( 'bp_embed_update_cache', 'bp_embed_message_save_cache', 10, 3 ); 2188 2274 } -
trunk/src/bp-messages/bp-messages-widgets.php
r11366 r13096 4 4 * 5 5 * @package BuddyPress 6 * @subpackage Messages 6 * @subpackage MessagesWidgets 7 7 * @since 1.9.0 8 8 */ … … 17 17 */ 18 18 function bp_messages_register_widgets() { 19 add_action( 'widgets_init', function() { register_widget( 'BP_Messages_Sitewide_Notices_Widget' ); } ); 19 add_action( 20 'widgets_init', 21 function() { 22 register_widget( 'BP_Messages_Sitewide_Notices_Widget' ); 23 } 24 ); 20 25 } 21 26 add_action( 'bp_register_widgets', 'bp_messages_register_widgets' ); -
trunk/src/bp-messages/classes/class-bp-messages-box-template.php
r12602 r13096 4 4 * 5 5 * @package BuddyPress 6 * @subpackage Messages Template6 * @subpackage MessagesClasses 7 7 * @since 1.5.0 8 8 */ … … 47 47 * The thread object currently being iterated on. 48 48 * 49 * @var object49 * @var BP_Messages_Thread|bool 50 50 */ 51 51 public $thread = false; … … 105 105 * @param array $args { 106 106 * Array of arguments. See bp_has_message_threads() for full description. 107 * } 107 * }. 108 108 */ 109 109 public function __construct( $args = array() ) { … … 230 230 */ 231 231 public function has_threads() { 232 if ( $this->thread_count ) { 233 return true; 234 } 235 236 return false; 232 return ( $this->thread_count ); 237 233 } 238 234 … … 240 236 * Set up the next member and iterate index. 241 237 * 242 * @return objectThe next member to iterate over.238 * @return BP_Messages_Thread The next member to iterate over. 243 239 */ 244 240 public function next_thread() { 245 241 $this->current_thread++; 246 $this->thread = $this->threads[ $this->current_thread];242 $this->thread = $this->threads[ $this->current_thread ]; 247 243 248 244 return $this->thread; … … 270 266 * @return bool True if there are more threads to show, otherwise false. 271 267 */ 272 function message_threads() {268 public function message_threads() { 273 269 if ( $this->current_thread + 1 < $this->thread_count ) { 274 270 return true; 275 } elseif ( $this->current_thread + 1 == $this->thread_count ) {271 } elseif ( $this->current_thread + 1 === $this->thread_count ) { 276 272 277 273 /** … … 308 304 309 305 // Set up the last message data. 310 if ( count( $this->thread->messages) > 1 ) {306 if ( count( $this->thread->messages ) > 1 ) { 311 307 if ( 'inbox' == $this->box ) { 312 308 foreach ( (array) $this->thread->messages as $key => $message ) { … … 335 331 336 332 // Loop has just started. 337 if ( 0 == $this->current_thread ) {333 if ( 0 === $this->current_thread ) { 338 334 339 335 /** -
trunk/src/bp-messages/classes/class-bp-messages-component.php
r13093 r13096 6 6 * 7 7 * @package BuddyPress 8 * @subpackage Messages Loader8 * @subpackage MessagesClasses 9 9 * @since 1.5.0 10 10 */ -
trunk/src/bp-messages/classes/class-bp-messages-message.php
r11307 r13096 15 15 */ 16 16 class BP_Messages_Message { 17 17 18 /** 18 19 * ID of the message. … … 80 81 /** 81 82 * Set up data related to a specific message object. 83 * 84 * @global BuddyPress $bp The one true BuddyPress instance. 85 * @global wpdb $wpdb WordPress database object. 82 86 * 83 87 * @param int $id ID of the message. … … 101 105 * Send a message. 102 106 * 107 * @global BuddyPress $bp The one true BuddyPress instance. 108 * @global wpdb $wpdb WordPress database object. 109 * 103 110 * @return int|bool ID of the newly created message on success, false on failure. 104 111 */ … … 180 187 * Get a list of recipients for a message. 181 188 * 189 * @global BuddyPress $bp The one true BuddyPress instance. 190 * @global wpdb $wpdb WordPress database object. 191 * 182 192 * @return object $value List of recipients for a message. 183 193 */ … … 221 231 * @since 2.8.0 222 232 * 223 * @param array $recipient_ids Array of recipients IDs that were retrieved based on submitted usernames.233 * @param array $recipient_ids Array of recipients IDs that were retrieved based on submitted usernames. 224 234 * @param array $recipient_usernames Array of recipients usernames that were submitted by a user. 225 235 */ … … 230 240 * Get the ID of the message last sent by the logged-in user for a given thread. 231 241 * 242 * @global BuddyPress $bp The one true BuddyPress instance. 243 * @global wpdb $wpdb WordPress database object. 244 * 232 245 * @param int $thread_id ID of the thread. 233 246 * … … 246 259 /** 247 260 * Check whether a user is the sender of a message. 261 * 262 * @global BuddyPress $bp The one true BuddyPress instance. 263 * @global wpdb $wpdb WordPress database object. 248 264 * 249 265 * @param int $user_id ID of the user. … … 266 282 * Get the ID of the sender of a message. 267 283 * 284 * @global BuddyPress $bp The one true BuddyPress instance. 285 * @global wpdb $wpdb WordPress database object. 286 * 268 287 * @param int $message_id ID of the message. 269 288 * -
trunk/src/bp-messages/classes/class-bp-messages-notice.php
r11293 r13096 19 19 */ 20 20 class BP_Messages_Notice { 21 21 22 /** 22 23 * The notice ID. 23 24 * 25 * @var int|null 26 */ 27 public $id = null; 28 29 /** 30 * The subject line for the notice. 31 * 32 * @var string 33 */ 34 public $subject; 35 36 /** 37 * The content of the notice. 38 * 39 * @var string 40 */ 41 public $message; 42 43 /** 44 * The date the notice was created. 45 * 46 * @var string 47 */ 48 public $date_sent; 49 50 /** 51 * Whether the notice is active or not. 52 * 24 53 * @var int 25 54 */ 26 public $id = null;27 28 /**29 * The subject line for the notice.30 *31 * @var string32 */33 public $subject;34 35 /**36 * The content of the notice.37 *38 * @var string39 */40 public $message;41 42 /**43 * The date the notice was created.44 *45 * @var string46 */47 public $date_sent;48 49 /**50 * Whether the notice is active or not.51 *52 * @var int53 */54 55 public $is_active; 55 56 … … 62 63 */ 63 64 public function __construct( $id = null ) { 64 if ( $id) {65 if ( ! empty( $id ) ) { 65 66 $this->id = (int) $id; 66 67 $this->populate(); … … 72 73 * 73 74 * Runs during constructor. 75 * 76 * @global BuddyPress $bp The one true BuddyPress instance. 77 * @global wpdb $wpdb WordPress database object. 74 78 * 75 79 * @since 1.0.0 … … 93 97 * Saves a notice. 94 98 * 99 * @global BuddyPress $bp The one true BuddyPress instance. 100 * @global wpdb $wpdb WordPress database object. 101 * 95 102 * @since 1.0.0 96 103 * … … 174 181 * Deletes a notice. 175 182 * 183 * @global BuddyPress $bp The one true BuddyPress instance. 184 * @global wpdb $wpdb WordPress database object. 185 * 176 186 * @since 1.0.0 177 187 * … … 215 225 * 216 226 * To get all notices, pass a value of -1 to pag_num. 227 * 228 * @global BuddyPress $bp The one true BuddyPress instance. 229 * @global wpdb $wpdb WordPress database object. 217 230 * 218 231 * @since 1.0.0 … … 223 236 * @type int $pag_page The page number. Defaults to 1. 224 237 * } 225 * @return objectList of notices to display.238 * @return array List of notices to display. 226 239 */ 227 240 public static function get_notices( $args = array() ) { … … 253 266 * @since 2.8.0 254 267 * 255 * @param array $r Array of parameters. 268 * @param array $notices List of notices sorted by date and paginated. 269 * @param array $r Array of parameters. 256 270 */ 257 271 return apply_filters( 'messages_notice_get_notices', $notices, $r ); … … 261 275 * Returns the total number of recorded notices. 262 276 * 277 * @global BuddyPress $bp The one true BuddyPress instance. 278 * @global wpdb $wpdb WordPress database object. 279 * 263 280 * @since 1.0.0 264 281 * … … 276 293 * 277 294 * @since 2.8.0 278 */ 279 return (int) apply_filters( 'messages_notice_get_total_notice_count', $notice_count ); 295 * 296 * @param int $notice_count Total number of recorded notices. 297 */ 298 return apply_filters( 'messages_notice_get_total_notice_count', (int) $notice_count ); 280 299 } 281 300 … … 283 302 * Returns the active notice that should be displayed on the front end. 284 303 * 285 * @since 1.0.0 286 * 287 * @return object The BP_Messages_Notice object. 304 * @global BuddyPress $bp The one true BuddyPress instance. 305 * @global wpdb $wpdb WordPress database object. 306 * 307 * @since 1.0.0 308 * 309 * @return BP_Messages_Notice 288 310 */ 289 311 public static function get_active() { … … 305 327 * 306 328 * @since 2.8.0 329 * 330 * @param BP_Messages_Notice $notice The notice object. 307 331 */ 308 332 return apply_filters( 'messages_notice_get_active', $notice ); -
trunk/src/bp-messages/classes/class-bp-messages-notices-admin.php
r12724 r13096 3 3 * BuddyPress messages component Site-wide Notices admin screen. 4 4 * 5 *6 5 * @package BuddyPress 7 * @subpackage Messages 6 * @subpackage MessagesClasses 8 7 * @since 3.0.0 9 8 */ … … 12 11 defined( 'ABSPATH' ) || exit; 13 12 13 /** 14 * BuddyPress Notices Admin class. 15 */ 14 16 class BP_Messages_Notices_Admin { 15 17 … … 34 36 * 35 37 * @since 3.0.0 36 * @var object38 * @var BP_Messages_Notices_List_Table|string 37 39 */ 38 40 public $list_table = ''; 39 41 40 41 /** 42 * Create a new instance or access the current instance of this class. 43 * 44 * @since 3.0.0 45 */ 42 /** 43 * Create a new instance or access the current instance of this class. 44 * 45 * @global BuddyPress $bp The one true BuddyPress instance. 46 * 47 * @since 3.0.0 48 * 49 * @return BP_Messages_Notices_Admin 50 */ 46 51 public static function register_notices_admin() { 47 52 … … 60 65 61 66 /** 62 * Constructor method.67 * Constructor. 63 68 * 64 69 * @since 3.0.0 -
trunk/src/bp-messages/classes/class-bp-messages-notices-list-table.php
r12592 r13096 4 4 * 5 5 * @package BuddyPress 6 * @subpackage Messages 6 * @subpackage MessagesClasses 7 7 * @since 3.0.0 8 8 */ … … 16 16 } 17 17 18 /** 19 * BuddyPress Notices List Table class. 20 */ 18 21 class BP_Messages_Notices_List_Table extends WP_List_Table { 19 22 … … 22 25 * 23 26 * @since 3.0.0 27 * 28 * @param array $args Arguments passed to the WP_List_Table::constructor. 24 29 */ 25 30 public function __construct( $args = array() ) { -
trunk/src/bp-messages/classes/class-bp-messages-sitewide-notices-widget.php
r12976 r13096 4 4 * 5 5 * @package BuddyPress 6 * @subpackage Messages 6 * @subpackage MessagesClasses 7 7 * @since 1.9.0 8 8 */ … … 24 24 * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options. 25 25 */ 26 function __construct() {26 public function __construct() { 27 27 parent::__construct( 28 28 'bp_messages_sitewide_notices_widget', … … 107 107 * 108 108 * @param array $instance See {@WP_Widget::form()}. 109 *110 * @return string|null Widget form output.111 109 */ 112 110 public function form( $instance ) { -
trunk/src/bp-messages/classes/class-bp-messages-thread-template.php
r10522 r13096 4 4 * 5 5 * @package BuddyPress 6 * @subpackage Messages Template6 * @subpackage MessagesClasses 7 7 * @since 1.5.0 8 8 */ … … 101 101 */ 102 102 public function has_messages() { 103 if ( ! empty( $this->message_count ) ) { 104 return true; 105 } 106 107 return false; 103 return ( ! empty( $this->message_count ) ); 108 104 } 109 105 110 106 /** 111 * Set up the next me mberand iterate index.107 * Set up the next message and iterate index. 112 108 * 113 * @return object The next memberto iterate over.109 * @return BP_Messages_Message The next message to iterate over. 114 110 */ 115 111 public function next_message() { -
trunk/src/bp-messages/classes/class-bp-messages-thread.php
r13086 r13096 213 213 */ 214 214 public function mark_read() { 215 BP_Messages_Thread::mark_as_read( $this->thread_id );215 self::mark_as_read( $this->thread_id ); 216 216 } 217 217 … … 224 224 */ 225 225 public function mark_unread() { 226 BP_Messages_Thread::mark_as_unread( $this->thread_id );226 self::mark_as_unread( $this->thread_id ); 227 227 } 228 228 … … 232 232 * @since 1.0.0 233 233 * @since 2.3.0 Added $thread_id as a parameter. 234 * 235 * @global BuddyPress $bp The one true BuddyPress instance. 236 * @global wpdb $wpdb WordPress database object. 234 237 * 235 238 * @param int $thread_id The thread ID. … … 283 286 * @since 2.3.0 284 287 * 288 * @global BuddyPress $bp The one true BuddyPress instance. 289 * @global wpdb $wpdb WordPress database object. 290 * 285 291 * @param int $thread_id The message thread ID. 286 292 * 287 * @return objectList of messages associated with a thread.293 * @return array List of messages associated with a thread. 288 294 */ 289 295 public static function get_messages( $thread_id = 0 ) { … … 334 340 * @since 2.7.0 The $user_id parameter was added. Previously the current user 335 341 * was always assumed. 342 * 343 * @global BuddyPress $bp The one true BuddyPress instance. 344 * @global wpdb $wpdb WordPress database object. 336 345 * 337 346 * @param int $thread_id The message thread ID. … … 428 437 * 429 438 * @since 1.0.0 439 * 440 * @global BuddyPress $bp The one true BuddyPress instance. 441 * @global wpdb $wpdb WordPress database object. 430 442 * 431 443 * @param array $args { … … 593 605 * @since 2.2.0 594 606 * 607 * @global wpdb $wpdb WordPress database object. 608 * 595 609 * @param array $meta_query An array of meta_query filters. See the 596 610 * documentation for WP_Meta_Query for details. … … 624 638 * @since 9.0.0 Added the `user_id` parameter. 625 639 * 640 * @global BuddyPress $bp The one true BuddyPress instance. 641 * @global wpdb $wpdb WordPress database object. 642 * 626 643 * @param int $thread_id The message thread ID. 627 644 * @param int $user_id The user the thread will be marked as read. 628 645 * 629 * @return false|int Number of threads marked as read or false on error.646 * @return bool|int Number of threads marked as read or false on error. 630 647 */ 631 648 public static function mark_as_read( $thread_id = 0, $user_id = 0 ) { … … 665 682 * @since 9.0.0 Added the `user_id` parameter. 666 683 * 684 * @global BuddyPress $bp The one true BuddyPress instance. 685 * @global wpdb $wpdb WordPress database object. 686 * 667 687 * @param int $thread_id The message thread ID. 668 688 * @param int $user_id The user the thread will be marked as unread. 669 689 * 670 * @return false|int Number of threads marked as unread or false on error.690 * @return bool|int Number of threads marked as unread or false on error. 671 691 */ 672 692 public static function mark_as_unread( $thread_id = 0, $user_id = 0 ) { … … 690 710 * 691 711 * @since 2.8.0 692 * @since 9.0.0 Added the `user_id` parameter. 693 * 694 * @param int $thread_id The message thread ID. 695 * @param int $user_id The user the thread will be marked as unread. 712 * @since 9.0.0 Added the `$user_id` parameter. 713 * @since 10.0.0 Added the `$retval` parameter. 714 * 715 * @param int $thread_id The message thread ID. 716 * @param int $user_id The user the thread will be marked as unread. 717 * @param bool|int $retval =Number of threads marked as unread or false on error. 696 718 */ 697 do_action( 'messages_thread_mark_as_unread', $thread_id, $user_id );719 do_action( 'messages_thread_mark_as_unread', $thread_id, $user_id, $retval ); 698 720 699 721 return $retval; … … 710 732 * @param string $type The type of messages to get. Either 'all' or 'unread'. 711 733 * or 'read'. Defaults to 'all'. 712 * @return int $valueTotal thread count for the provided user.734 * @return int Total thread count for the provided user. 713 735 */ 714 736 public static function get_total_threads_for_user( $user_id, $box = 'inbox', $type = 'all' ) { … … 736 758 * @since 1.0.0 737 759 * 760 * @global BuddyPress $bp The one true BuddyPress instance. 761 * @global wpdb $wpdb WordPress database object. 762 * 738 763 * @param int $thread_id The message thread ID. 739 764 * @return bool … … 750 775 } 751 776 752 return in_array( bp_loggedin_user_id(), $sender_ids );777 return in_array( bp_loggedin_user_id(), $sender_ids, true ); 753 778 } 754 779 … … 757 782 * 758 783 * @since 1.0.0 784 * 785 * @global BuddyPress $bp The one true BuddyPress instance. 786 * @global wpdb $wpdb WordPress database object. 759 787 * 760 788 * @param int $thread_id The message thread ID. … … 778 806 * @since 1.0.0 779 807 * 808 * @global BuddyPress $bp The one true BuddyPress instance. 809 * @global wpdb $wpdb WordPress database object. 810 * 780 811 * @param int $user_id The user ID. 781 * @return int $unread_countTotal inbox unread count for user.812 * @return int Total inbox unread count for user. 782 813 */ 783 814 public static function get_inbox_count( $user_id = 0 ) { … … 839 870 * 840 871 * @param int $thread_id The message thread ID. 841 * @return false|int|null The message thread ID on success, null on failure.872 * @return bool|int|null The message thread ID on success, null on failure. 842 873 */ 843 874 public static function is_valid( $thread_id = 0 ) { … … 868 899 * 869 900 * @param array $recipients Array containing the message recipients (array of objects). 870 * @return string $valueString of message recipent userlinks.901 * @return string String of message recipent userlinks. 871 902 */ 872 903 public static function get_recipient_links( $recipients ) { … … 895 926 * Upgrade method for the older BP message thread DB table. 896 927 * 928 * @todo We should remove this. No one is going to upgrade from v1.1, right? 929 * 897 930 * @since 1.2.0 898 931 * 899 * @todo We should remove this. No one is going to upgrade from v1.1, right? 932 * @global BuddyPress $bp The one true BuddyPress instance. 933 * @global wpdb $wpdb WordPress database object. 934 * 900 935 * @return bool 901 936 */ -
trunk/src/bp-messages/screens/compose.php
r11925 r13096 1 1 <?php 2 2 /** 3 * Messages: User's "Messages > Compose" screen handler 3 * Messages: User's "Messages > Compose" screen handler. 4 4 * 5 5 * @package BuddyPress -
trunk/src/bp-messages/screens/inbox.php
r11925 r13096 1 1 <?php 2 2 /** 3 * Messages: User's "Messages" screen handler 3 * Messages: User's "Messages" screen handler. 4 4 * 5 5 * @package BuddyPress -
trunk/src/bp-messages/screens/notices.php
r11925 r13096 1 1 <?php 2 2 /** 3 * Messages: User's "Messages > Notices" screen handler 3 * Messages: User's "Messages > Notices" screen handler. 4 4 * 5 5 * @package BuddyPress … … 12 12 * 13 13 * @since 1.0.0 14 *15 * @return false|null False on failure.16 14 */ 17 15 function messages_screen_notices() { -
trunk/src/bp-messages/screens/sentbox.php
r11925 r13096 1 1 <?php 2 2 /** 3 * Messages: User's "Messages > Sent" screen handler 3 * Messages: User's "Messages > Sent" screen handler. 4 4 * 5 5 * @package BuddyPress -
trunk/src/bp-messages/screens/starred.php
r12055 r13096 1 1 <?php 2 2 /** 3 * Messages: User's "Messages > Starred" screen handler 3 * Messages: User's "Messages > Starred" screen handler. 4 4 * 5 5 * @package BuddyPress -
trunk/src/bp-messages/screens/view.php
r12592 r13096 1 1 <?php 2 2 /** 3 * Messages: Conversation thread screen handler 3 * Messages: Conversation thread screen handler. 4 4 * 5 5 * @package BuddyPress … … 13 13 * @since 1.0.0 14 14 * 15 * @return false|null False on failure. 15 * @global BuddyPress $bp The one true BuddyPress instance. 16 * 17 * @return bool False on failure. 16 18 */ 17 19 function messages_screen_conversation() { … … 50 52 51 53 // Decrease the unread count in the nav before it's rendered. 52 $count 53 $class 54 $count = bp_get_total_unread_messages_count(); 55 $class = ( 0 === $count ) ? 'no-count' : 'count'; 54 56 55 57 /* translators: 1: class name. 2: number of messages */
Note: See TracChangeset
for help on using the changeset viewer.