Skip to content

Commit

Permalink
When a user leaves a group, remove them from the groupblog.
Browse files Browse the repository at this point in the history
Previously, users were only demoted to 'subscriber'. This resulted
in situations where a user was a member of 'orphan' sites that
could not easily be left.
  • Loading branch information
boonebgorges committed Jul 12, 2023
1 parent 124aeaf commit 1371740
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions bp-groupblog.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,8 @@ function bp_groupblog_remove_user( $group_id, $user_id = false ) {
return;
}

$user = new WP_User( $user_id );
$user->for_blog( $blog_id );
$user->set_role( 'subscriber' );
remove_user_from_blog( $user_id, $blog_id, 0 );

wp_cache_delete( $user_id, 'users' );
}
add_action( 'groups_leave_group', 'bp_groupblog_remove_user', 10, 2 );
Expand Down

0 comments on commit 1371740

Please sign in to comment.