bp_groups_has_group_type( int $group_id, string $group_type )

Check whether the given group has a certain group type.


Description Description


Parameters Parameters

$group_id

(Required) ID of the group.

$group_type

(Required) Group type.


Top ↑

Return Return

(bool) Whether the group has the give group type.


Top ↑

Source Source

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

function bp_groups_has_group_type( $group_id, $group_type ) {
	if ( empty( $group_type ) || ! bp_groups_get_group_type_object( $group_type ) ) {
		return false;
	}

	// Get all group's group types.
	$types = bp_groups_get_group_type( $group_id, false );

	if ( ! is_array( $types ) ) {
		return false;
	}

	return in_array( $group_type, $types );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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