groups_uninvite_user( int $user_id, int $group_id, int $inviter_id = false )

Uninvite a user from a group.


Parameters Parameters

$user_id

(int) (Required) ID of the user.

$group_id

(int) (Required) ID of the group.

$inviter_id

(int) (Optional) ID of the inviter.

Default value: false


Top ↑

Return Return

(bool) True on success, false on failure.


Source Source

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

function groups_uninvite_user( $user_id, $group_id, $inviter_id = false ) {
	if ( empty( $user_id ) || empty( $group_id ) ) {
		return false;
	}

	$invites_class = new BP_Groups_Invitation_Manager();
	$success       = $invites_class->delete( array(
		'user_id'    => $user_id,
		'item_id'    => $group_id,
		'inviter_id' => $inviter_id,
	) );

	if ( $success ) {
		/**
		 * Fires after uninviting a user from a group.
		 *
		 * @since 1.0.0
		 * @since 2.7.0 Added $inviter_id parameter
		 *
		 * @param int $group_id    ID of the group being uninvited from.
		 * @param int $user_id     ID of the user being uninvited.
		 * @param int $inviter_id  ID of the inviter.
		 */
		do_action( 'groups_uninvite_user', $group_id, $user_id, $inviter_id );
	}

	return $success;
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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