Skip to content

Commit

Permalink
Don't remove them, if we're about to add them back in.
Browse files Browse the repository at this point in the history
  • Loading branch information
ideadude committed Apr 7, 2020
1 parent 763dce7 commit de51957
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions includes/groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ function pmpro_bp_set_member_groups( $level_id, $user_id, $cancel_level ) {

if ( ! empty( $old_groups_invite ) ) {
foreach ( $old_groups_invite as $group_id ) {
groups_uninvite_user( $user_id, $group_id );
// remove user from group as well
// Don't remove them, if we're about to add them back in.
if ( in_array( $group_id, $new_groups_invite ) ) {
continue;
}

// Uninvite and remove from group.
groups_uninvite_user( $user_id, $group_id );
groups_leave_group( $group_id, $user_id );
}
}
Expand Down

0 comments on commit de51957

Please sign in to comment.