• Resolved artmerk

    (@artmerk)


    Sync works in most cases, for example if email address is changed, then the listener flags a background job, which runs on next hourly cron and updates the mailchimp list.

    However this problem:

    I wrote a custom function to ‘not subscribe’ based on user_meta values (specifically ‘account_status’ used with Ultimate Member). The function works perfectly if I do a complete “Manual Synchronization”. But the listener does not pick up on the change to the meta-value which should trigger an update. Is there a hook or way to change the listener to flag a background job for this user if user_meta is changed?

    add_filter( 'mailchimp_sync_should_sync_user', function( $sync, $user ) {
        // setup array of account statuses which should be excluded from Syncing.
        $account_status = get_user_meta( $user->ID, 'account_status', true );
        $dont_sync_status = array(
          'inactive',
          'awaiting_admin_review'
        );
        // do not synchronize user if it has the status
        if( in_array( $account_status, $dont_sync_status ) ) {
          return false;
        }
        // use default value (from settings)
        return $sync;
    }, 10, 2);
    

    If this is not easy to fix, is there a function or do_action we can run via Cron to do a full Manual Synchronization, just like can be done in the Admin area??

    • This topic was modified 7 years, 1 month ago by artmerk.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Sync is not flagging a background job, based on change to user data’ is closed to new replies.