groups_ban_member( int $user_id, int $group_id )

Ban a member from a group.

Description

Parameters

$user_id

(Required) ID of the user.

$group_id

(Required) ID of the group.

Return

(bool) True on success, false on failure.

Source

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

2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
function groups_ban_member( $user_id, $group_id ) {
 
    if ( ! bp_is_item_admin() )
        return false;
 
    $member = new BP_Groups_Member( $user_id, $group_id );
 
    /**
     * Fires before the banning of a member from a group.
     *
     * @since BuddyPress 1.0.0
     *
     * @param int $group_id ID of the group being banned from.
     * @param int $user_id  ID of the user being banned.
     */
    do_action( 'groups_ban_member', $group_id, $user_id );
 
    return $member->ban();
}

Changelog

Changelog
Version Description
BuddyPress 1.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.