diff --git src/bp-messages/bp-messages-template.php src/bp-messages/bp-messages-template.php
index ad380b132..c28fbedbd 100644
|
|
function bp_message_thread_to() { |
273 | 273 | /** |
274 | 274 | * Output the permalink for a particular thread. |
275 | 275 | * |
| 276 | * @since 2.9.0 Introduced `$user_id` parameter. |
| 277 | * |
276 | 278 | * @param int $thread_id Optional. ID of the thread. Default: current thread |
277 | 279 | * being iterated on in the loop. |
| 280 | * @param int $user_id Optional. ID of the user relative to whom the link |
| 281 | * should be generated. Default: ID of logged-in user. |
278 | 282 | */ |
279 | | function bp_message_thread_view_link( $thread_id = 0 ) { |
280 | | echo bp_get_message_thread_view_link( $thread_id ); |
| 283 | function bp_message_thread_view_link( $thread_id = 0, $user_id = null ) { |
| 284 | echo bp_get_message_thread_view_link( $thread_id, $user_id ); |
281 | 285 | } |
282 | 286 | /** |
283 | 287 | * Get the permalink of a particular thread. |
284 | 288 | * |
| 289 | * @since 2.9.0 Introduced `$user_id` parameter. |
| 290 | * |
285 | 291 | * @param int $thread_id Optional. ID of the thread. Default: current |
286 | 292 | * thread being iterated on in the loop. |
| 293 | * @param int $user_id Optional. ID of the user relative to whom the link |
| 294 | * should be generated. Default: ID of logged-in user. |
287 | 295 | * @return string |
288 | 296 | */ |
289 | | function bp_get_message_thread_view_link( $thread_id = 0 ) { |
| 297 | function bp_get_message_thread_view_link( $thread_id = 0, $user_id = null ) { |
290 | 298 | global $messages_template; |
291 | 299 | |
292 | 300 | if ( empty( $messages_template ) && (int) $thread_id > 0 ) { |
… |
… |
function bp_message_thread_view_link( $thread_id = 0 ) { |
295 | 303 | $thread_id = $messages_template->thread->thread_id; |
296 | 304 | } |
297 | 305 | |
| 306 | if ( null === $user_id ) { |
| 307 | $user_id = bp_loggedin_user_id(); |
| 308 | } |
| 309 | |
| 310 | $domain = bp_core_get_user_domain( $user_id ); |
| 311 | |
298 | 312 | /** |
299 | 313 | * Filters the permalink of a particular thread. |
300 | 314 | * |
301 | 315 | * @since 1.0.0 |
302 | 316 | * @since 2.6.0 Added the `$thread_id` parameter. |
| 317 | * @since 2.9.0 Added the `$user_id` parameter. |
303 | 318 | * |
304 | 319 | * @param string $value Permalink of a particular thread. |
305 | 320 | * @param int $thread_id ID of the thread. |
306 | 321 | */ |
307 | | return apply_filters( 'bp_get_message_thread_view_link', trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id ), $thread_id ); |
| 322 | return apply_filters( 'bp_get_message_thread_view_link', trailingslashit( $domain . bp_get_messages_slug() . '/view/' . $thread_id ), $thread_id, $user_id ); |
308 | 323 | } |
309 | 324 | |
310 | 325 | /** |
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 d71ded236..9e0dded3c 100644
|
|
do_action( 'bp_before_member_messages_loop' ); ?> |
115 | 115 | <?php endif; ?> |
116 | 116 | |
117 | 117 | <td class="thread-info"> |
118 | | <p><a href="<?php bp_message_thread_view_link(); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( "View Message", 'buddypress' ); ?>" aria-label="<?php esc_attr_e( "View Message", 'buddypress' ); ?>"><?php bp_message_thread_subject(); ?></a></p> |
| 118 | <p><a href="<?php bp_message_thread_view_link( bp_get_message_thread_id(), bp_displayed_user_id() ); ?>" class="bp-tooltip" data-bp-tooltip="<?php esc_attr_e( "View Message", 'buddypress' ); ?>" aria-label="<?php esc_attr_e( "View Message", 'buddypress' ); ?>"><?php bp_message_thread_subject(); ?></a></p> |
119 | 119 | <p class="thread-excerpt"><?php bp_message_thread_excerpt(); ?></p> |
120 | 120 | </td> |
121 | 121 | |