bbp_get_topic_replies_link( int $topic_id )

Return the replies link of the topic


Description Description


Parameters Parameters

$topic_id

(Optional) Topic id


Top ↑

Source Source

File: includes/topics/template.php

	function bbp_get_topic_replies_link( $topic_id = 0 ) {
		$topic_id = bbp_get_topic_id( $topic_id );
		$link     = bbp_get_topic_permalink( $topic_id );
		$replies  = sprintf( _n( '%s reply', '%s replies', bbp_get_topic_reply_count( $topic_id, true ), 'bbpress' ), bbp_get_topic_reply_count( $topic_id, false ) );

		// First link never has view=all
		$retval = bbp_get_view_all( 'edit_others_replies' )
			? "<a href='" . esc_url( bbp_remove_view_all( $link ) ) . "'>" . esc_html( $replies ) . "</a>"
			: $replies;

		// Any deleted replies?
		$deleted_int = bbp_get_topic_reply_count_hidden( $topic_id, true  );

		// This topic has hidden replies
		if ( ! empty( $deleted_int ) && current_user_can( 'edit_others_replies' ) ) {

			// Hidden replies
			$deleted_num = bbp_get_topic_reply_count_hidden( $topic_id, false );
			$extra       = ' ' . sprintf( _n( '(+%s hidden)', '(+%s hidden)', $deleted_int, 'bbpress' ), $deleted_num );

			// Hidden link
			$retval .= ! bbp_get_view_all( 'edit_others_replies' )
				? " <a href='" . esc_url( bbp_add_view_all( $link, true ) ) . "'>" . esc_html( $extra ) . "</a>"
				: " {$extra}";
		}

		// Filter & return
		return apply_filters( 'bbp_get_topic_replies_link', $retval, $topic_id );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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