Cant remove users from buddypress groups
-
Hello :),
Please help me, I am trying to remove all users with membership id 943 & also those with no subscription from buddypress groups. Also members with no subscription, I have used the following code but both aren’t working:
/*Remove user from groups*/ function mwale_remove_from_group_on_membership_deactivate( $event, $subscription ) { $member = MS_Model_Member::get_current_member(); if ( $member->has_membership( 943 ) ) { return; } groups_remove_data_for_user( $user->ID ); } add_action( 'ms_model_event_deactivated', 'mwale_remove_from_group_on_membership_deactivate', 10, 2 )
and also:
function mwale_remove_from_group_on_membership_deactivate( $event, $subscription ) { $member = $subscription->get_member(); $user = $member->get_user(); if ( ! $user || is_a( $user, 'WP_User' ) ) { return; } groups_remove_data_for_user( $user->ID ); } add_action( 'ms_model_event_deactivated', 'mwale_remove_from_group_on_membership_deactivate', 10, 2 );
Thank you
The page I need help with: [log in to see the link]
Viewing 14 replies - 1 through 14 (of 14 total)
Viewing 14 replies - 1 through 14 (of 14 total)
- The topic ‘Cant remove users from buddypress groups’ is closed to new replies.