bbp_get_topic_close_link( mixed $args = '' )

Return the close link of the topic

Description

Parameters

$args

(mixed) (Optional) This function supports these args: - id: Optional. Topic id - link_before: Before the link - link_after: After the link - close_text: Close text - open_text: Open text

Default value: ''

Return

(string) Topic close link

Source

File: bp-forums/topics/template.php

	function bbp_get_topic_close_link( $args = '' ) {

		// Parse arguments against default values
		$r = bbp_parse_args( $args, array(
			'id'          => 0,
			'link_before' => '',
			'link_after'  => '',
			'sep'         => ' | ',
			'close_text'  => __( 'Close', 'buddyboss' ),
			'open_text'   => __( 'Open', 'buddyboss' )
		), 'get_topic_close_link' );

		$topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );

		if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) )
			return;

		$display = bbp_is_topic_open( $topic->ID ) ? $r['close_text'] : $r['open_text'];
		$uri     = add_query_arg( array( 'action' => 'bbp_toggle_topic_close', 'topic_id' => $topic->ID ) );
		$uri     = wp_nonce_url( $uri, 'close-topic_' . $topic->ID );
		$retval  = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-close-link">' . $display . '</a>' . $r['link_after'];

		return apply_filters( 'bbp_get_topic_close_link', $retval, $r );
	}

Changelog

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