BP_Groups_Member::get_group_moderator_ids( int $group_id )

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


Parameters Parameters

$group_id

(int) (Required) ID of the group.


Top ↑

Return Return

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


Source Source

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

	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;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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