bbp_is_forum_closed( int $forum_id, bool $check_ancestors = true )
Is the forum closed?
Description
Parameters
- $forum_id
-
(Optional) Forum id
- $check_ancestors
-
(Optional) Check if the ancestors are closed (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_closed( $forum_id = 0, $check_ancestors = true ) { $forum_id = bbp_get_forum_id( $forum_id ); $retval = ( bbp_get_closed_status_id() === bbp_get_forum_status( $forum_id ) ); if ( !empty( $check_ancestors ) ) { $ancestors = bbp_get_forum_ancestors( $forum_id ); foreach ( (array) $ancestors as $ancestor ) { if ( bbp_is_forum_category( $ancestor, false ) && bbp_is_forum_closed( $ancestor, false ) ) { $retval = true; } } } return (bool) apply_filters( 'bbp_is_forum_closed', (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.