BP_Groups_Member::delete_invite( int $user_id, int $group_id, int $inviter_id = false )

Delete an invitation, by specifying user ID and group ID.

Description

Parameters

$user_id

(Required) ID of the user.

$group_id

(Required) ID of the group.

$inviter_id

(Optional) ID of the inviter. Specify if you want to delete a specific invite. Leave false if you want to delete all invites to this group.

Default value: false

Return

(int) Number of records deleted.

Source

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

	public static function delete_invite( $user_id, $group_id ) {
		global $wpdb;

		if ( empty( $user_id ) ) {
			return false;
		}

		/**
		 * Fires before a group invitation is deleted.
		 *
		 * @since BuddyPress 2.6.0
		 *
		 * @param int $user_id  ID of the user.
		 * @param int $group_id ID of the group.
		 */
		do_action( 'bp_groups_member_before_delete_invite', $user_id, $group_id );

		$table_name = buddypress()->groups->table_name_members;

		$sql = "DELETE FROM {$table_name}
				WHERE user_id = %d
					AND group_id = %d
					AND is_confirmed = 0
					AND inviter_id != 0";

		$prepared = $wpdb->prepare( $sql, $user_id, $group_id );

		return $wpdb->query( $prepared );
	}

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.