bbp_is_forum_private( int $forum_id, bool $check_ancestors = true )
Is the forum private?
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_private( $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_private_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_private( $ancestor, false ) ) { $retval = true; } } } return (bool) apply_filters( 'bbp_is_forum_private', (bool) $retval, $forum_id, $check_ancestors ); }
Changelog
Version | Description |
---|---|
bbPress (r2746) | 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.