bp_group_mod_ids( BP_Groups_Group|bool $group = false, string $format = 'string' )
Return a list of user IDs for a group’s moderators.
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) $mod_ids A string or array of user IDs.
Source
File: bp-groups/bp-groups-template.php
function bp_group_mod_ids( $group = false, $format = 'string' ) { global $groups_template; if ( empty( $group ) ) { $group =& $groups_template->group; } $mod_ids = array(); if ( $group->mods ) { foreach( $group->mods as $mod ) { $mod_ids[] = $mod->user_id; } } if ( 'string' == $format ) { $mod_ids = implode( ',', $mod_ids ); } /** * Filters a list of user IDs for a group's moderators. * * 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 moderators. * @param object $group Group object. */ return apply_filters( 'bp_group_mod_ids', $mod_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.