diff --git src/bp-groups/bp-groups-functions.php src/bp-groups/bp-groups-functions.php
index a65f82d..3d158da 100644
|
|
function groups_leave_group( $group_id, $user_id = 0 ) { |
440 | 440 | } |
441 | 441 | } |
442 | 442 | |
443 | | if ( ! groups_remove_member( $user_id, $group_id ) ) { |
| 443 | if ( ! groups_remove_member( $user_id, $group_id, true ) ) { |
444 | 444 | return false; |
445 | 445 | } |
446 | 446 | |
… |
… |
function groups_unban_member( $user_id, $group_id ) { |
1427 | 1427 | /** |
1428 | 1428 | * Remove a member from a group. |
1429 | 1429 | * |
1430 | | * @param int $user_id ID of the user. |
1431 | | * @param int $group_id ID of the group. |
| 1430 | * @param int $user_id ID of the user. |
| 1431 | * @param int $group_id ID of the group. |
| 1432 | * @param bool $_leave_group FOR INTERNAL USE ONLY! Is the user leaving a group? |
1432 | 1433 | * |
1433 | 1434 | * @return bool True on success, false on failure. |
1434 | 1435 | */ |
1435 | | function groups_remove_member( $user_id, $group_id ) { |
| 1436 | function groups_remove_member( $user_id, $group_id, $_leave_group = false ) { |
1436 | 1437 | |
1437 | 1438 | if ( ! bp_is_item_admin() ) { |
1438 | 1439 | // bp_is_item_admin may not be set if this function is called outside of group context. |
… |
… |
function groups_remove_member( $user_id, $group_id ) { |
1447 | 1448 | |
1448 | 1449 | $member = new BP_Groups_Member( $user_id, $group_id ); |
1449 | 1450 | |
1450 | | /** |
1451 | | * Fires before the removal of a member from a group. |
1452 | | * |
1453 | | * @since BuddyPress (1.2.6) |
1454 | | * |
1455 | | * @param int $group_id ID of the group being removed from. |
1456 | | * @param int $user_id ID of the user being removed. |
1457 | | */ |
1458 | | do_action( 'groups_remove_member', $group_id, $user_id ); |
| 1451 | if ( false === $_leave_group ) { |
| 1452 | /** |
| 1453 | * Fires before the removal of a member from a group. This action will not be |
| 1454 | * fired if we're calling `groups_remove_member()` via `groups_leave_group()`. |
| 1455 | * |
| 1456 | * @since BuddyPress (1.2.6) |
| 1457 | * |
| 1458 | * @see https://buddypress.trac.wordpress.org/ticket/6597 |
| 1459 | * |
| 1460 | * @param int $group_id ID of the group being removed from. |
| 1461 | * @param int $user_id ID of the user being removed. |
| 1462 | */ |
| 1463 | do_action( 'groups_remove_member', $group_id, $user_id ); |
| 1464 | } |
1459 | 1465 | |
1460 | 1466 | return $member->remove(); |
1461 | 1467 | } |