groups_remove_group_invite()
Process group invitation removal requests.
Description
Note that this function is only used when JS is disabled. Normally, clicking Remove Invite removes the invitation via AJAX.
Source
File: bp-groups/screens/single/invite.php
function groups_remove_group_invite() {
if ( ! bp_is_group_invites() ) {
return;
}
if ( ! bp_is_action_variable( 'remove', 0 ) || ! is_numeric( bp_action_variable( 1 ) ) ) {
return;
}
if ( ! check_admin_referer( 'groups_invite_uninvite_user' ) ) {
return false;
}
$friend_id = intval( bp_action_variable( 1 ) );
$group_id = bp_get_current_group_id();
$message = __( 'Invite successfully removed', 'buddyboss' );
$redirect = wp_get_referer();
$error = false;
if ( ! bp_groups_user_can_send_invites( $group_id ) ) {
$message = __( 'You are not allowed to send or remove invites', 'buddyboss' );
$error = 'error';
} elseif ( groups_check_for_membership_request( $friend_id, $group_id ) ) {
$message = __( 'The member requested to join the group', 'buddyboss' );
$error = 'error';
} elseif ( ! groups_uninvite_user( $friend_id, $group_id ) ) {
$message = __( 'There was an error removing the invite', 'buddyboss' );
$error = 'error';
}
bp_core_add_message( $message, $error );
bp_core_redirect( $redirect );
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.0.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.