bbp_get_forum_topics_link( int $forum_id )

Return the topics link of the forum


Description Description


Parameters Parameters

$forum_id

(Optional) Topic id


Top ↑

Source Source

File: includes/forums/template.php

	function bbp_get_forum_topics_link( $forum_id = 0 ) {
		$forum_id = bbp_get_forum_id( $forum_id );
		$link     = bbp_get_forum_permalink( $forum_id );
		$topics   = sprintf( _n( '%s topic', '%s topics', bbp_get_forum_topic_count( $forum_id, true, true ), 'bbpress' ), bbp_get_forum_topic_count( $forum_id, true, false ) );

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

		// Get deleted topics
		$deleted_int = bbp_get_forum_topic_count_hidden( $forum_id, false, true );

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

			// Hidden text
			$deleted_num = bbp_get_forum_topic_count_hidden( $forum_id, false, false );
			$extra       = ' ' . sprintf( _n( '(+%s hidden)', '(+%s hidden)', $deleted_int, 'bbpress' ), $deleted_num );

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

		// Filter & return
		return apply_filters( 'bbp_get_forum_topics_link', $retval, $forum_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.