Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that deleted users are unsubscribed from Mailchimp Audiences #70

Closed
dparker1005 opened this issue Jul 24, 2019 · 2 comments
Closed

Comments

@dparker1005
Copy link
Member

I believe that when a user is deleted, their membership is removed. But there could still be opt-in lists that they need to be removed from.

@himanshuahuja96
Copy link

I have came across a solution which works fine and below is the sample code.

add_action('delete_user','pmpro_mailchimp_handle_delete');
function pmpro_mailchimp_handle_delete( $user_id ){
	pmpromc_unsubscribeFromLists($user_id);
}

I also tried adding the user to the unsubscribe queue we had in the plugin itself but there was issue like we are executing pmpromc_unsubscribeFromLists this method with three hooks and all of them seems to be not working due to execution order. Like wp_redirect executes and before delete_user itself, user gets deleted from the wordpress and hence when we call pmpromc_unsubscribeFromLists in mean while our user gets deleted and we have nothing in hand to delete the user and we fail in deleting the user.

add_action('delete_user','pmpro_mailchimp_handle_delete');
function pmpro_mailchimp_handle_delete( $user_id ){
pmpromc_queueUserToUnsubscribeFromLists($user_id);
}

@dparker1005
Copy link
Member Author

Duplicate of #77

@dparker1005 dparker1005 marked this as a duplicate of #77 Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants