BuddyPressCommand::get_group_id_from_identifier( int|string $group_id )

Get a group ID from its identifier (ID or slug).


Parameters Parameters

$group_id

(int|string) (Required) Group ID or slug.


Top ↑

Return Return

(int|bool)


Source Source

File: cli/src/command.php

	protected function get_group_id_from_identifier( $group_id ) {
		// Group ID or slug.
		if ( ! is_numeric( $group_id ) ) {
			$group_id = groups_get_id( $group_id );
		}

		// Get group object.
		$group_obj = groups_get_group(
			array(
				'group_id' => $group_id,
			)
		);

		if ( empty( $group_obj->id ) ) {
			WP_CLI::error( 'No group found by that slug or ID.' );
		}

		return intval( $group_obj->id );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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