BP_Groups_Member::check_is_mod( int $user_id, int $group_id )

Check whether a user is a mod of a given group.

Description

Parameters

$user_id

(Required) ID of the user.

$group_id

(Required) ID of the group.

Return

(mixed)

Source

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

1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
public static function check_is_mod( $user_id, $group_id ) {
    global $wpdb;
 
    if ( empty( $user_id ) )
        return false;
 
    $bp = buddypress();
 
    return $wpdb->query( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_mod = 1 AND is_banned = 0", $user_id, $group_id ) );
}

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.