bp_get_message_thread_view_link( int $thread_id, int $user_id = null )
Get the permalink of a particular thread.
Description Description
Parameters Parameters
- $thread_id
-
(Optional) ID of the thread. Default: current thread being iterated on in the loop.
- $user_id
-
(Optional) ID of the user relative to whom the link should be generated. Default: ID of logged-in user.
Default value: null
Return Return
(string)
Source Source
File: bp-messages/bp-messages-template.php
function bp_get_message_thread_view_link( $thread_id = 0, $user_id = null ) { global $messages_template; if ( empty( $messages_template ) && (int) $thread_id > 0 ) { $thread_id = (int) $thread_id; } elseif ( ! empty( $messages_template->thread->thread_id ) ) { $thread_id = $messages_template->thread->thread_id; } if ( null === $user_id ) { $user_id = bp_loggedin_user_id(); } $domain = bp_core_get_user_domain( $user_id ); /** * Filters the permalink of a particular thread. * * @since 1.0.0 * @since 2.6.0 Added the `$thread_id` parameter. * @since 2.9.0 Added the `$user_id` parameter. * * @param string $value Permalink of a particular thread. * @param int $thread_id ID of the thread. * @param int $user_id ID of the user. */ return apply_filters( 'bp_get_message_thread_view_link', trailingslashit( $domain . bp_get_messages_slug() . '/view/' . $thread_id ), $thread_id, $user_id ); }
Changelog Changelog
Version | Description |
---|---|
2.9.0 | Introduced. |