bbp_get_topic_reply_link( array $args = array() )

Return the link to go directly to the reply form

Description

Parameters

$args

(Optional) Arguments

Default value: array()

Return

(string) Link for a reply to a topic

Source

File: bp-forums/topics/template.php

	function bbp_get_topic_reply_link( $args = array() ) {

		// Parse arguments against default values
		$r = bbp_parse_args( $args, array(
			'id'           => 0,
			'link_before'  => '',
			'link_after'   => '',
			'reply_text'   => esc_html__( 'Reply', 'buddyboss' ),
		), 'get_topic_reply_link' );

		// Get the reply to use it's ID and post_parent
		$topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );

		// Bail if no reply or user cannot reply
		if ( empty( $topic ) || ! bbp_current_user_can_access_create_reply_form() )
			return;

		$uri = '#new-post';

		// Add $uri to the array, to be passed through the filter
		$r['uri'] = $uri;
		$retval   = $r['link_before'] . '<a href="' . esc_url( $r['uri'] ) . '" data-modal-id="bbp-reply-form" class="bbp-topic-reply-link">' . $r['reply_text'] . '</a>' . $r['link_after'];

		return apply_filters( 'bbp_get_topic_reply_link', $retval, $r, $args );
	}

Changelog

Changelog
Version Description
bbPress (r4966) Introduced.

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.