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

Check whether a user is a member 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

1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
public static function check_is_member( $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_confirmed = 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.