bp_register_active_group_types()

Register all active group types.

Description

Source

File: bp-groups/bp-groups-functions.php

function bp_register_active_group_types() {

	$post_ids = bp_get_active_group_types();

	//update meta cache to avoid multiple db calls
	update_meta_cache( 'post', $post_ids );

	//build to register the group type
	$group_types = array();

	foreach ( $post_ids as $post_id ) {

		$name    = get_post_meta( $post_id, '_bp_group_type_label_name', true );
		$key    = get_post_meta( $post_id, '_bp_group_type_key', true );
		$singular_name    = get_post_meta( $post_id, '_bp_group_type_label_singular_name', true );
		$group_types       = bp_groups_get_group_types();
		if ( ! in_array( $singular_name, $group_types, true ) ) {
			$temp = array(
				'labels'                => array(
					'name'          => $name,
					'singular_name' => $singular_name,
				),
				'has_directory'         => strtolower( $name ),
				'show_in_create_screen' => true,
				'show_in_list'          => true,
				'description'           => '',
				'create_screen_checked' => false,
			);
			bp_groups_register_group_type( $key, $temp );
		}
	}
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 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.