bbp_get_topic_favorite_link( $args = array() )

Get the forum favorite link


Description Description

A custom wrapper for bbp_get_user_favorites_link()


Source Source

File: includes/topics/template.php

	function bbp_get_topic_favorite_link( $args = array() ) {

		// No link
		$retval      = false;
		$user_id     = bbp_get_current_user_id();
		$redirect_to = bbp_is_favorites()
			? bbp_get_favorites_permalink( $user_id )
			: '';

		// Parse the arguments
		$r = bbp_parse_args( $args, array(
			'user_id'     => $user_id,
			'object_id'   => bbp_get_topic_id(),
			'object_type' => 'post',
			'before'      => '',
			'after'       => '',
			'favorite'    => esc_html__( 'Favorite',   'bbpress' ),
			'favorited'   => esc_html__( 'Unfavorite', 'bbpress' ),
			'redirect_to' => $redirect_to
		), 'get_topic_favorite_link' );

		// Get the link
		$retval = bbp_get_user_favorites_link( $r );

		// Filter & return
		return apply_filters( 'bbp_get_topic_favorite_link', $retval, $r, $args );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 bbPress (r6308) Add 'redirect_to' support
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.