bp_group_admin_ids( BP_Groups_Group|bool $group = false, string $format = 'string' )
Return a list of user IDs for a group’s admins.
Description
Parameters
- $group
-
(Optional) The group being queried. Defaults to the current group in the loop.
Default value: false
- $format
-
(Optional) 'string' to get a comma-separated string, 'array' to get an array.
Default value: 'string'
Return
(mixed) $admin_ids A string or array of user IDs.
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 BuddyPress 1.5.0
* @since BuddyPress 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 );
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 1.5.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.