bbp_get_forum_topics_link( int $forum_id )

Return the topics link of the forum

Description

Parameters

$forum_id

(int) (Optional) Topic id

Source

File: bp-forums/forums/template.php

	function bbp_get_forum_topics_link( $forum_id = 0 ) {
		$forum    = bbp_get_forum( $forum_id );
		$forum_id = $forum->ID;
		$topics   = sprintf( _n( '%s discussion', '%s discussions', bbp_get_forum_topic_count( $forum_id, true, false ), 'buddyboss' ), bbp_get_forum_topic_count( $forum_id ) );
		$retval   = '';

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

		// Get deleted topics
		$deleted = bbp_get_forum_topic_count_hidden( $forum_id );

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

			// 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_forum_permalink( $forum_id ), true ) ) . "'>" . esc_html( $extra ) . "</a>";
			}
		}

		return apply_filters( 'bbp_get_forum_topics_link', $retval, $forum_id );
	}

Changelog

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