bbp_is_forum_hidden( int $forum_id, bool $check_ancestors = true )
Is the forum hidden?
Description
Parameters
- $forum_id
-
(Optional) Forum id
- $check_ancestors
-
(Optional) Check if the ancestors are private (only if they're a category)
Default value: true
Return
(bool) True if closed, false if not
Source
File: bp-forums/forums/template.php
function bbp_is_forum_hidden( $forum_id = 0, $check_ancestors = true ) { $forum_id = bbp_get_forum_id( $forum_id ); $visibility = bbp_get_forum_visibility( $forum_id ); // If post status is private, return true $retval = ( bbp_get_hidden_status_id() === $visibility ); // Check ancestors and inherit their privacy setting for display if ( !empty( $check_ancestors ) ) { $ancestors = bbp_get_forum_ancestors( $forum_id ); foreach ( (array) $ancestors as $ancestor ) { if ( bbp_is_forum( $ancestor ) && bbp_is_forum_hidden( $ancestor, false ) ) { $retval = true; } } } return (bool) apply_filters( 'bbp_is_forum_hidden', (bool) $retval, $forum_id, $check_ancestors ); }
Changelog
Version | Description |
---|---|
bbPress (r2997) | 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.