BBP_Forums_Group_Extension::disconnect_forum_from_group( int $group_id )
Listening to BuddyBoss Group deletion to remove the forum
Description
Parameters
- $group_id
-
(Required) The group ID
Source
File: bp-forums/groups.php
public function disconnect_forum_from_group( $group_id = 0 ) {
// Bail if no group ID available
if ( empty( $group_id ) ) {
return;
}
// Get the forums for the current group
$forum_ids = bbp_get_group_forum_ids( $group_id );
// Use the first forum ID
if ( empty( $forum_ids ) )
return;
// Get the first forum ID
$forum_id = (int) is_array( $forum_ids ) ? $forum_ids[0] : $forum_ids;
$this->remove_forum( array(
'forum_id' => $forum_id,
'group_id' => $group_id
) );
}
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.