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

Check whether a user has an outstanding membership request for a given group.

Description

Parameters

$user_id

(Required) ID of the user.

$group_id

(Required) ID of the group.

Return

(int) Database ID of the membership if found; int 0 on failure.

Source

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

	public static function check_for_membership_request( $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 = 0 AND is_banned = 0 AND inviter_id = 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.