BP_Groups_Member::get_group_moderator_ids( int $group_id )

Get a list of all a given group’s moderators.

Description

Parameters

$group_id

(Required) ID of the group.

Return

(array) Info about group mods (user_id + date_modified).

Source

File: bp-groups/classes/class-bp-groups-member.php

1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
public static function get_group_moderator_ids( $group_id ) {
    global $wpdb;
 
    if ( empty( $group_id ) ) {
        return array();
    }
 
    $group_mods = wp_cache_get( $group_id, 'bp_group_mods' );
 
    if ( false === $group_mods ) {
        self::prime_group_admins_mods_cache( array( $group_id ) );
        $group_mods = wp_cache_get( $group_id, 'bp_group_mods' );
    }
 
    if ( false === $group_mods ) {
        // The wp_cache_get is still coming up empty. Return an empty array.
        $group_mods = array();
    } else {
        // Cast the user_id property as an integer.
        foreach ( (array) $group_mods as $key => $data ) {
            $group_mods[ $key ]->user_id = (int) $group_mods[ $key ]->user_id;
        }
    }
 
    return $group_mods;
}

Changelog

Changelog
Version Description
BuddyPress 1.6.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.