bbp_get_topic_replies_link( int $topic_id )

Return the replies link of the topic

Description

Parameters

$topic_id

(int) (Optional) Topic id

Source

File: bp-forums/topics/template.php

	function bbp_get_topic_replies_link( $topic_id = 0 ) {

		$topic    = bbp_get_topic( bbp_get_topic_id( (int) $topic_id ) );
		$topic_id = $topic->ID;
		$replies  = sprintf( _n( '%s reply', '%s replies', bbp_get_topic_reply_count( $topic_id, true ), 'buddyboss' ), bbp_get_topic_reply_count( $topic_id ) );
		$retval   = '';

		// First link never has view=all
		if ( bbp_get_view_all( 'edit_others_replies' ) )
			$retval .= "<a href='" . esc_url( bbp_remove_view_all( bbp_get_topic_permalink( $topic_id ) ) ) . "'>$replies</a>";
		else
			$retval .= $replies;

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

		// This forum has hidden topics
		if ( !empty( $deleted ) && current_user_can( 'edit_others_replies' ) ) {

			// Extra text
			$extra = sprintf( __( ' (+ %d hidden)', 'buddyboss' ), $deleted );

			// No link
			if ( bbp_get_view_all() ) {
				$retval .= " $extra";

			// Link
			} else {
				$retval .= " <a href='" . esc_url( bbp_add_view_all( bbp_get_topic_permalink( $topic_id ), true ) ) . "'>$extra</a>";
			}
		}

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

Changelog

Changelog
Version Description
bbPress (r2740) 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.