- Timestamp:
- 07/02/2021 01:10:12 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/classes/class-bp-messages-thread.php
r12592 r12984 613 613 * 614 614 * @since 1.0.0 615 * @since 9.0.0 Added the `user_id` parameter. 615 616 * 616 617 * @param int $thread_id The message thread ID. 618 * @param int $user_id The user the thread will be marked as read. 617 619 * 618 620 * @return false|int Number of threads marked as read or false on error. 619 621 */ 620 public static function mark_as_read( $thread_id = 0 ) { 621 global $wpdb; 622 623 $user_id = 624 bp_displayed_user_id() ? 625 bp_displayed_user_id() : 626 bp_loggedin_user_id(); 622 public static function mark_as_read( $thread_id = 0, $user_id = 0 ) { 623 global $wpdb; 624 625 if ( empty( $user_id ) ) { 626 $user_id = 627 bp_displayed_user_id() ? 628 bp_displayed_user_id() : 629 bp_loggedin_user_id(); 630 } 627 631 628 632 $bp = buddypress(); … … 636 640 * 637 641 * @since 2.8.0 642 * @since 9.0.0 Added the `user_id` parameter. 638 643 * 639 644 * @param int $thread_id The message thread ID. 645 * @param int $user_id The user the thread will be marked as read. 640 646 */ 641 do_action( 'messages_thread_mark_as_read', $thread_id );647 do_action( 'messages_thread_mark_as_read', $thread_id, $user_id ); 642 648 643 649 return $retval; … … 648 654 * 649 655 * @since 1.0.0 656 * @since 9.0.0 Added the `user_id` parameter. 650 657 * 651 658 * @param int $thread_id The message thread ID. 659 * @param int $user_id The user the thread will be marked as unread. 652 660 * 653 661 * @return false|int Number of threads marked as unread or false on error. 654 662 */ 655 public static function mark_as_unread( $thread_id = 0 ) { 656 global $wpdb; 657 658 $user_id = 659 bp_displayed_user_id() ? 660 bp_displayed_user_id() : 661 bp_loggedin_user_id(); 663 public static function mark_as_unread( $thread_id = 0, $user_id = 0 ) { 664 global $wpdb; 665 666 if ( empty( $user_id ) ) { 667 $user_id = 668 bp_displayed_user_id() ? 669 bp_displayed_user_id() : 670 bp_loggedin_user_id(); 671 } 662 672 663 673 $bp = buddypress(); … … 671 681 * 672 682 * @since 2.8.0 683 * @since 9.0.0 Added the `user_id` parameter. 673 684 * 674 685 * @param int $thread_id The message thread ID. 686 * @param int $user_id The user the thread will be marked as unread. 675 687 */ 676 do_action( 'messages_thread_mark_as_unread', $thread_id );688 do_action( 'messages_thread_mark_as_unread', $thread_id, $user_id ); 677 689 678 690 return $retval;
Note: See TracChangeset
for help on using the changeset viewer.