Title: Do not sync inactive users
Last modified: August 30, 2016

---

# Do not sync inactive users

 *  Resolved [meglos42](https://wordpress.org/support/users/meglos42/)
 * (@meglos42)
 * [11 years ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/)
 * I am using the WP Members plugin & have a number of inactive on my site, awaiting
   moderation.
    I don’t want these to sync with Mailchimp until activated – is this
   possible?
 * [https://wordpress.org/plugins/mailchimp-sync/](https://wordpress.org/plugins/mailchimp-sync/)

Viewing 13 replies - 1 through 13 (of 13 total)

 *  Plugin Author [Harish Chouhan](https://wordpress.org/support/users/hchouhan/)
 * (@hchouhan)
 * [11 years ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390342)
 * Hello meglos42,
 * Currently the only option is to sync all users or to choose what user role you
   wish to subscribe. If you set non-active users in a different role and convert
   them to “Subscriber” role after account activation then you would be able to 
   sync only the active users by choosing “Subscribers” as the role to sync.
 * I hope I have answered your query, if not please do let me know.
 *  Thread Starter [meglos42](https://wordpress.org/support/users/meglos42/)
 * (@meglos42)
 * [11 years ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390343)
 * Hi Harish,
 * Not really I’m afraid. I’m using 3 user roles and wish to sync all of them with
   the mailchimp list, so limiting sync to only “Subscribers” isn’t an option for
   me.
    Also when new users register for access to the protected areas of the site
   their login requests are moderated and it’s important that they don’t get any
   newsletters before they have been activated.
 * Thanks.
 *  Plugin Author [Harish Chouhan](https://wordpress.org/support/users/hchouhan/)
 * (@hchouhan)
 * [11 years ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390345)
 * Hey meglos42,
 * While there is no direct way of doing that I would discuss this with my colleagues
   to see if there are any way to do this. Please do allow us a few days to get 
   back.
 *  Thread Starter [meglos42](https://wordpress.org/support/users/meglos42/)
 * (@meglos42)
 * [11 years ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390451)
 * Hi Harish,
 * Have you come up with a solution at all?
 * Another option – I have created a custom role with no site access and set that
   to the default new member role.
 * Is there (or could there be built) an option to synchronise several selected 
   roles only (not just one), so I can exclude this custom role but include Admin
   and Author roles?
 * Thanks
 *  Plugin Author [Harish Chouhan](https://wordpress.org/support/users/hchouhan/)
 * (@hchouhan)
 * [11 years ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390452)
 * Hi,
 * Danny my colleague has just got back to work, so he should be able to get look
   into this and get back to you by next week.
 *  Plugin Author [Danny van Kooten](https://wordpress.org/support/users/dvankooten/)
 * (@dvankooten)
 * [11 years ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390456)
 * Hi [@meglos42](https://wordpress.org/support/users/meglos42/),
 * How are you handling inactive users? Is that functionality added by a plugin 
   or maybe some core WordPress functionality I don’t know about yet?
 * I hope to release an update of MailChimp Sync this week that at least lets you
   control whether a certain user should be subscribed using a filter, so you can
   add some code to your theme its functions.php file and use whatever criteria 
   you like. That said, knowing the details of your use case would be immensely 
   helpful in making such things easier. 🙂
 * Thanks in advance!
 *  Thread Starter [meglos42](https://wordpress.org/support/users/meglos42/)
 * (@meglos42)
 * [11 years ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390458)
 * Hi Danny,
 * I’m using the ‘WP Members’ plugin to moderate user accounts. A lot of the site
   is restricted and accessible only by logged-in users (99% of the user accounts
   are Subscribers).
 * By default site registrations are open, but a user is inactive (via an “active”
   field in the usermeta table) until activated by an administrator. Only then can
   they access the protected content.
    I’d like to ensure that these pending users
   don’t get any emails until they have been confirmed and activated.
 * Hope this helps 🙂
 *  Plugin Author [Danny van Kooten](https://wordpress.org/support/users/dvankooten/)
 * (@dvankooten)
 * [11 years ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390459)
 * Hey [@meglos42](https://wordpress.org/support/users/meglos42/), that definitely
   helps! We’ll push out an update of the plugin this week after which I’ll get 
   back to this topic with a code example for you to use.
 *  Plugin Author [Danny van Kooten](https://wordpress.org/support/users/dvankooten/)
 * (@dvankooten)
 * [11 years ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390461)
 * Hey meglos42,
 * We’ve just pushed out version 1.0.2 of the plugin which includes a filter called`
   mailchimp_sync_should_sync_user` that lets you set your own criteria to decide
   whether a user should be subscribed.
 * The following code should help you get started.
 *     ```
       add_filter( 'mailchimp_sync_should_sync_user', 'myprefix_sync_criteria', 10, 2 );
   
       function myprefix_sync_criteria( $sync, $user ) {
   
           // make sure user has meta data named "active"
           $active = get_user_meta( $user->ID, 'active', true );
   
           // you might want to make the next line more strict
           // depending on what the value of the user_meta is..
           if( ! $active ) {
             $sync = false;
           }
   
           return $sync;
       }
       ```
   
 * Does that help?
 *  Thread Starter [meglos42](https://wordpress.org/support/users/meglos42/)
 * (@meglos42)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390463)
 * Hi Danny,
 * Hopefully so, I’lll test over the next day or two. Thanks for your time & effort
   working on this.
    Just to clarify, WP-Members adds a new lines (1 per user) to
   the metadata table with the following field values – umeta_id = xxx user_id =
   yyy meta_key = ‘active’ meta_value = ‘0’ or ‘1’ (depending on whether the user
   is active or not)
 * Not sure if this affects the way the function needs to be constructed?
 *  Thread Starter [meglos42](https://wordpress.org/support/users/meglos42/)
 * (@meglos42)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390471)
 * Hi Danny,
 * That works perfectly!
    Many thanks once again.
 *  Thread Starter [meglos42](https://wordpress.org/support/users/meglos42/)
 * (@meglos42)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390472)
 * Hi again Danny,
 * Looks like I spoke too soon.
 * The plugin/function doesn’t sync inactive users when I “synchronise all”, which
   is great.
    However when it’s listening to changes it doesn’t seem to pick up 
   a change in the “active” state from “1” to “0” or vice versa, which means that
   new WordPress user registrations don’t get added to the Mailchimp list when they’re
   activated, nor do users get unsubscribed when they are deactivated. Deleting 
   the user still unsubscribes them OK.
 * Is there anything can be done to get this working?
 * Thanks.
 *  [mother.of.code](https://wordpress.org/support/users/imazed/)
 * (@imazed)
 * The Mother of Code
 * [10 years, 11 months ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390484)
 * As meglos42 has opened a new topic on this, further replies can be read [here](https://wordpress.org/support/topic/sync_should_sync_user?replies=3#post-7395768).

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Do not sync inactive users’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/mailchimp-sync_cfeefa.svg)
 * [MC4WP: Mailchimp User Sync](https://wordpress.org/plugins/mailchimp-sync/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailchimp-sync/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailchimp-sync/)
 * [Active Topics](https://wordpress.org/support/plugin/mailchimp-sync/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailchimp-sync/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailchimp-sync/reviews/)

## Tags

 * [inactive](https://wordpress.org/support/topic-tag/inactive/)

 * 13 replies
 * 4 participants
 * Last reply from: [mother.of.code](https://wordpress.org/support/users/imazed/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/do-not-sync-inactive-users/#post-6390484)
 * Status: resolved