bbp_get_excluded_forum_ids()

Returns the forum IDs that should be excluded from various views & queries, based on the current user’s capabilities.


Description Description

These results are automatically filtered by bbp_allow_forums_of_user(), to allow per-forum moderators to see forums that would otherwise be private or hidden to them.

If you have a need to filter these results based on your own custom engagements API usages, please see: bbp_allow_forums_of_user()


Return Return

(array) Forum IDs to exclude, or an empty array


Top ↑

Source Source

File: includes/forums/functions.php

function bbp_get_excluded_forum_ids() {

	// Private forums
	$private = ! current_user_can( 'read_private_forums' )
		? bbp_get_private_forum_ids()
		: array();

	// Hidden forums
	$hidden = ! current_user_can( 'read_hidden_forums' )
		? bbp_get_hidden_forum_ids()
		: array();

	// Merge private & hidden forums together, and remove any empties
	$forum_ids = ( ! empty( $private ) || ! empty( $hidden ) )
		? array_filter( wp_parse_id_list( array_merge( $private, $hidden ) ) )
		: array();

	// Filter & return
	return (array) apply_filters( 'bbp_get_excluded_forum_ids', $forum_ids, $private, $hidden );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.