diff --git src/bp-messages/bp-messages-template.php src/bp-messages/bp-messages-template.php
index c5b4f40..54dc747 100644
|
|
function bp_has_message_threads( $args = array() ) { |
63 | 63 | |
64 | 64 | // User ID |
65 | 65 | // @todo displayed user for moderators that get this far? |
66 | | $user_id = bp_loggedin_user_id(); |
| 66 | $user_id = bp_displayed_user_id(); |
67 | 67 | |
68 | 68 | // Search Terms. |
69 | 69 | $search_terms = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; |
… |
… |
function bp_message_thread_view_link( $thread_id = 0 ) { |
309 | 309 | * @param string $value Permalink of a particular thread. |
310 | 310 | * @param int $thread_id ID of the thread. |
311 | 311 | */ |
312 | | return apply_filters( 'bp_get_message_thread_view_link', trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id ), $thread_id ); |
| 312 | return apply_filters( 'bp_get_message_thread_view_link', trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id ), $thread_id ); |
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
… |
… |
function bp_message_thread_delete_link() { |
334 | 334 | * @param string $value URL for deleting the current thread. |
335 | 335 | * @param string $value Text indicating action being executed. |
336 | 336 | */ |
337 | | return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/delete/' . $messages_template->thread->thread_id ), 'messages_delete_thread' ) ); |
| 337 | return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/delete/' . $messages_template->thread->thread_id ), 'messages_delete_thread' ) ); |
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
… |
… |
function bp_the_message_thread_mark_unread_url() { |
366 | 366 | ); |
367 | 367 | |
368 | 368 | // Base unread URL. |
369 | | $url = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/unread' ); |
| 369 | $url = trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/unread' ); |
370 | 370 | |
371 | 371 | // Add the args to the URL. |
372 | 372 | $url = add_query_arg( $args, $url ); |
… |
… |
function bp_the_message_thread_mark_read_url() { |
413 | 413 | ); |
414 | 414 | |
415 | 415 | // Base read URL. |
416 | | $url = trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/read' ); |
| 416 | $url = trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/read' ); |
417 | 417 | |
418 | 418 | // Add the args to the URL. |
419 | 419 | $url = add_query_arg( $args, $url ); |
… |
… |
function bp_message_thread_avatar( $args = '' ) { |
700 | 700 | |
701 | 701 | /** |
702 | 702 | * Output the unread messages count for the current inbox. |
| 703 | * |
| 704 | * @since 2.6.x Added $user_id argument. |
| 705 | * |
| 706 | * @param int $user_id The user ID. |
| 707 | * |
| 708 | * @return int $unread_count Total inbox unread count for user. |
703 | 709 | */ |
704 | | function bp_total_unread_messages_count() { |
705 | | echo bp_get_total_unread_messages_count(); |
| 710 | function bp_total_unread_messages_count( $user_id = 0 ) { |
| 711 | echo bp_get_total_unread_messages_count( $user_id ); |
706 | 712 | } |
707 | 713 | /** |
708 | 714 | * Get the unread messages count for the current inbox. |
709 | 715 | * |
710 | | * @return int |
| 716 | * @since 2.6.x Added $user_id argument. |
| 717 | * |
| 718 | * @param int $user_id The user ID. |
| 719 | * |
| 720 | * @return int $unread_count Total inbox unread count for user. |
711 | 721 | */ |
712 | | function bp_get_total_unread_messages_count() { |
| 722 | function bp_get_total_unread_messages_count( $user_id = 0 ) { |
713 | 723 | |
714 | 724 | /** |
715 | 725 | * Filters the unread messages count for the current inbox. |
… |
… |
function bp_total_unread_messages_count() { |
718 | 728 | * |
719 | 729 | * @param int $value Unread messages count for the current inbox. |
720 | 730 | */ |
721 | | return apply_filters( 'bp_get_total_unread_messages_count', BP_Messages_Thread::get_inbox_count() ); |
| 731 | return apply_filters( 'bp_get_total_unread_messages_count', BP_Messages_Thread::get_inbox_count( $user_id ) ); |
722 | 732 | } |
723 | 733 | |
724 | 734 | /** |
… |
… |
function bp_messages_form_action() { |
825 | 835 | * |
826 | 836 | * @param string $value The form action. |
827 | 837 | */ |
828 | | return apply_filters( 'bp_get_messages_form_action', trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' . bp_action_variable( 0 ) ) ); |
| 838 | return apply_filters( 'bp_get_messages_form_action', trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' . bp_action_variable( 0 ) ) ); |
829 | 839 | } |
830 | 840 | |
831 | 841 | /** |
… |
… |
function bp_message_notice_delete_link() { |
1150 | 1160 | * @param string $value URL for deleting the current notice. |
1151 | 1161 | * @param string $value Text indicating action being executed. |
1152 | 1162 | */ |
1153 | | return apply_filters( 'bp_get_message_notice_delete_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices/delete/' . $messages_template->thread->id, 'messages_delete_thread' ) ); |
| 1163 | return apply_filters( 'bp_get_message_notice_delete_link', wp_nonce_url( bp_displayed_user_domain() . bp_get_messages_slug() . '/notices/delete/' . $messages_template->thread->id, 'messages_delete_thread' ) ); |
1154 | 1164 | } |
1155 | 1165 | |
1156 | 1166 | /** |
… |
… |
function bp_message_activate_deactivate_link() { |
1168 | 1178 | global $messages_template; |
1169 | 1179 | |
1170 | 1180 | if ( 1 === (int) $messages_template->thread->is_active ) { |
1171 | | $link = wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices/deactivate/' . $messages_template->thread->id ), 'messages_deactivate_notice' ); |
| 1181 | $link = wp_nonce_url( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/notices/deactivate/' . $messages_template->thread->id ), 'messages_deactivate_notice' ); |
1172 | 1182 | } else { |
1173 | | $link = wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices/activate/' . $messages_template->thread->id ), 'messages_activate_notice' ); |
| 1183 | $link = wp_nonce_url( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/notices/activate/' . $messages_template->thread->id ), 'messages_activate_notice' ); |
1174 | 1184 | } |
1175 | 1185 | |
1176 | 1186 | /** |
… |
… |
function bp_the_thread_delete_link() { |
1911 | 1921 | * @param string $value URL for deleting the current thread. |
1912 | 1922 | * @param string $value Text indicating action being executed. |
1913 | 1923 | */ |
1914 | | return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/inbox/delete/' . bp_get_the_thread_id(), 'messages_delete_thread' ) ); |
| 1924 | return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( bp_displayed_user_domain() . bp_get_messages_slug() . '/inbox/delete/' . bp_get_the_thread_id(), 'messages_delete_thread' ) ); |
1915 | 1925 | } |
1916 | 1926 | |
1917 | 1927 | /** |
diff --git src/bp-messages/classes/class-bp-messages-component.php src/bp-messages/classes/class-bp-messages-component.php
index 334f90e..638077d 100644
|
|
class BP_Messages_Component extends BP_Component { |
147 | 147 | |
148 | 148 | // Only grab count if we're on a user page and current user has access. |
149 | 149 | if ( bp_is_user() && bp_user_has_access() ) { |
150 | | $count = bp_get_total_unread_messages_count(); |
| 150 | $count = bp_get_total_unread_messages_count( bp_displayed_user_id() ); |
151 | 151 | $class = ( 0 === $count ) ? 'no-count' : 'count'; |
152 | 152 | $nav_name = sprintf( |
153 | 153 | /* translators: %s: Unread message count for the current user */ |
… |
… |
class BP_Messages_Component extends BP_Component { |
205 | 205 | 'position' => 20, |
206 | 206 | 'user_has_access' => $access |
207 | 207 | ); |
208 | | |
| 208 | // @TODO: Should "compose" only be available if the current user is the displayed user? |
209 | 209 | $sub_nav[] = array( |
210 | 210 | 'name' => __( 'Compose', 'buddypress' ), |
211 | 211 | 'slug' => 'compose', |
diff --git src/bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php src/bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php
index a99018f..976873c 100644
|
|
do_action( 'bp_before_member_messages_loop' ); ?> |
45 | 45 | */ |
46 | 46 | do_action( 'bp_before_member_messages_threads' ); ?> |
47 | 47 | |
48 | | <form action="<?php echo bp_loggedin_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ?>/bulk-manage/" method="post" id="messages-bulk-management"> |
| 48 | <form action="<?php echo bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ?>/bulk-manage/" method="post" id="messages-bulk-management"> |
49 | 49 | |
50 | 50 | <table id="message-threads" class="messages-notices"> |
51 | 51 | |