bbp_exclude_forum_ids( $type = 'string' )
Returns a meta_query that either includes or excludes hidden forum IDs from a query.
Description Description
Parameters Parameters
-
(Optional) The type of value to return. (string|array|meta_query)
Source Source
File: includes/forums/functions.php
function bbp_exclude_forum_ids( $type = 'string' ) { // Setup arrays $forum_ids = array(); // Types $types = array( 'array' => array(), 'string' => '', 'meta_query' => array() ); // Exclude for everyone but keymasters if ( ! bbp_is_user_keymaster() ) { // Get forum IDs to exclude $forum_ids = bbp_get_excluded_forum_ids(); // Store return values in static types array if ( ! empty( $forum_ids ) ) { // Comparison $compare = ( 1 < count( $forum_ids ) ) ? 'NOT IN' : '!='; // Setup types $types['array'] = $forum_ids; $types['string'] = implode( ',', $forum_ids ); $types['meta_query'] = array( 'key' => '_bbp_forum_id', 'value' => $types['string'], 'type' => 'NUMERIC', 'compare' => $compare ); } } // There are forums that need to be excluded $retval = $types[ $type ]; // Filter & return return apply_filters( 'bbp_exclude_forum_ids', $retval, $forum_ids, $type ); }
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |