Tagged: `
No Problem. Please do let me know when you get a response from them.
Regards
BrajeshHi Brajesh,
the plugin support said to use something like this:
function ms_subscription_expired_action( $subscription, $membership, $member ){ //Do stuff } add_action( 'ms_subscription_status-' . MS_Model_Relationship::STATUS_EXPIRED, 'ms_subscription_expired_action', 10, 3 );
Kind regards,
MwaleHi Mwale,
In that case, you can use my code from herehttps://buddydev.com/support/forums/topic/how-to-remove-buddypress-user-from-all-groups/#post-13894
and change this line
add_action( 'ms_model_event_deactivated', 'mwale_remove_from_group_on_membership_deactivate', 10, 2 );
to
add_action( 'ms_subscription_status-' . MS_Model_Relationship::STATUS_EXPIRED, 'mwale_remove_from_group_on_membership_deactivate', 10, 2 );
That should most probably work.
Please give it a try.
Hello Brajesh,
Unfortunately that leads to a white blank screen. But I have a feeling that we almost have it. What could be the issue?
The entire code I added is this:
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_subscription_status-' . MS_Model_Relationship::STATUS_EXPIRED, 'mwale_remove_from_group_on_membership_deactivate', 10, 2 );
Warm regards,
MwalePlease check the error log and post me what error do you see there?
Sorry about this. 3rd party plugin support, specially ones that we don’t use is tricky.
I hope that the original plugin developers will assist you with proper action.
The part of code
groups_remove_data_for_user( $user->ID );
Is guaranteed to remove the user from all groups but it seems I am not using the correct hook to attach to.
Regards
BrajeshHi Brajesh,
I want to say thank you very much for helping me on this topic. Unfortunately I have not been able to make the best(more efficient) solution work, so I am using the inefficient code here: https://buddydev.com/support/forums/topic/how-to-remove-buddypress-user-from-all-groups/#post-14107 . This is the solution I am currently using. As such I am marking this topic as solved, thanks again.
Kind regards,
MwaleHi Mwale,
No problem.I am sorry that I could not do much with a 3rd party plugin.
It’s fine to use that code but I am a bit purist and I won’t.
Regards
Brajesh
The topic ‘ [Resolved] How to remove buddypress user from all groups’ is closed to new replies.