BBP_Forums_Group_Extension::disconnect_forum_from_group( int $group_id )

Listening to BuddyPress Group deletion to remove the forum


Description Description


Parameters Parameters

$group_id

(Required) The group ID


Top ↑

Source Source

File: includes/extend/buddypress/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 );

		// Bail if no forum IDs available
		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
		) );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.