BP_REST_Forums_Endpoint::get_forum_current_user_permissions( int $forum_id )

Forum permissions for the current user.

Description

Parameters

$forum_id

(Required) ID of the forum.

Return

(array|void)

Source

File: bp-forums/classes/class-bp-rest-forums-endpoint.php

	public function get_forum_current_user_permissions( $forum_id ) {
		if ( empty( $forum_id ) ) {
			return;
		}

		$forum = bbp_get_forum( bbp_get_forum_id( (int) $forum_id ) );

		return array(
			'show_topics'   => $this->can_access_content( $forum_id ),
			'show_subforum' => $this->can_access_content( $forum_id ),
			'create_topic'  => (
				! empty( $forum )
				&& ! bbp_is_forum_category()
				&& ( bbp_current_user_can_publish_topics() || bbp_current_user_can_access_anonymous_user_form() )
				&& $this->can_access_content( $forum_id, true )
			),
		);
	}

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.