bp_get_message_thread_view_link( int $thread_id, int $user_id = null )

Get the permalink of a particular thread.

Description

Parameters

$thread_id

(int) (Optional) ID of the thread. Default: current thread being iterated on in the loop.

$user_id

(int) (Optional) ID of the user relative to whom the link should be generated. Default: ID of logged-in user.

Default value: null

Return

(string)

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 BuddyPress 1.0.0
		 * @since BuddyPress 2.6.0 Added the `$thread_id` parameter.
		 * @since BuddyPress 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 );
	}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.