bp_members_invitations_delete_by_id( int $id )

Delete a membership invitation by id.


Parameters Parameters

$id

(int) (Required) ID of the invitation to delete.


Top ↑

Return Return

(int|bool) Number of rows deleted on success, false on failure.


Source Source

File: bp-members/bp-members-functions.php

function bp_members_invitations_delete_by_id( $id = 0 ) {

	// Find the invitation before deleting it.
	$existing_invite = new BP_Invitation( $id );
	$invites_class   = new BP_Members_Invitation_Manager();
	$success         = $invites_class->delete_by_id( $id );

	if ( ! $success ) {
		return $success;
	}

	// Run a different action depending on the status of the invite.
	if ( ! $existing_invite->invite_sent ) {
		/**
		 * Fires after the deletion of an unsent community invite.
		 *
		 * @since 8.0.0
		 *
		 * @param BP_Invitation $existing_invite The invitation to be deleted.
		 */
		do_action( 'bp_members_invitations_canceled_invitation', $existing_invite );
	} else if ( ! $existing_invite->accepted ) {
		/**
		 * Fires after the deletion of a sent, but not yet accepted, community invite.
		 *
		 * @since 8.0.0
		 *
		 * @param BP_Invitation $existing_invite The invitation to be deleted.
		 */
		do_action( 'bp_members_invitations_revoked_invitation', $existing_invite );
	} else {
		/**
		 * Fires after the deletion of a sent and accepted community invite.
		 *
		 * @since 8.0.0
		 *
		 * @param BP_Invitation $existing_invite The invitation to be deleted.
		 */
		do_action( 'bp_members_invitations_deleted_invitation', $existing_invite );
	}

	return $success;
}


Top ↑

Changelog Changelog

Changelog
Version Description
8.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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