bp_group_admin_ids( BP_Groups_Group|bool $group = false, string $format = 'string' )

Return a list of user IDs for a group’s admins.


Parameters Parameters

$group

(BP_Groups_Group|bool) (Optional) The group being queried. Defaults to the current group in the loop.

Default value: false

$format

(string) (Optional) 'string' to get a comma-separated string, 'array' to get an array.

Default value: 'string'


Top ↑

Return Return

(mixed) $admin_ids A string or array of user IDs.


Source Source

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

function bp_group_admin_ids( $group = false, $format = 'string' ) {
	global $groups_template;

	if ( empty( $group ) ) {
		$group =& $groups_template->group;
	}

	$admin_ids = array();

	if ( $group->admins ) {
		foreach( $group->admins as $admin ) {
			$admin_ids[] = $admin->user_id;
		}
	}

	if ( 'string' == $format ) {
		$admin_ids = implode( ',', $admin_ids );
	}

	/**
	 * Filters a list of user IDs for a group's admins.
	 *
	 * This filter may return either an array or a comma separated string.
	 *
	 * @since 1.5.0
	 * @since 2.5.0 Added the `$group` parameter.
	 *
	 * @param array|string $admin_ids List of user IDs for a group's admins.
	 * @param object       $group     Group object.
	 */
	return apply_filters( 'bp_group_admin_ids', $admin_ids, $group );
}


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.