Title: Update Users with additional Field
Last modified: June 29, 2022

---

# Update Users with additional Field

 *  Resolved [digihouse](https://wordpress.org/support/users/digihouse/)
 * (@digihouse)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/update-users-with-additional-field/)
 * Hi,
 * we created a function to add a new field:
 *     ```
       function custom_user_merge_tags($merge_vars, $user) {
   
       	// Get the WP_User ID
           $user_id = $user->ID;
       	// Get the WP_User roles and capabilities
           $user_roles = $user->roles;
       	// Letzte User Rolle im Array ist die Händlergruppe
       	$client_user_role = end($user_roles);
       	/// add whatever you want to the merge tags
           $merge_vars['USERROLLE'] = $client_user_role;
   
           return $merge_vars;
       }
   
       add_filter('mailchimp_sync_user_mergetags', 'custom_user_merge_tags', 100, 2);
       ```
   
 * As soon as a new user registers it works fine. But i can’t update existing users.
   
   If i click resync nothing happens. Users are not updated.
 * Any ideas?
 * thx
    Chris

Viewing 1 replies (of 1 total)

 *  Plugin Author [ryanhungate](https://wordpress.org/support/users/ryanhungate/)
 * (@ryanhungate)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/update-users-with-additional-field/#post-15807078)
 * [@digihouse](https://wordpress.org/support/users/digihouse/) the people that 
   would be synced are the ones that have placed orders. This doesn’t just take 
   the wordpress userbase, it works off of order history and new users moving forward.
 * Right now the only way to do this would be to execute an update on the users 
   and then you should see that happen as expected.
 * Thanks for the feedback!

Viewing 1 replies (of 1 total)

The topic ‘Update Users with additional Field’ is closed to new replies.

 * ![](https://ps.w.org/mailchimp-for-woocommerce/assets/icon-256x256.png?rev=1509501)
 * [Mailchimp for WooCommerce](https://wordpress.org/plugins/mailchimp-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailchimp-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [ryanhungate](https://wordpress.org/support/users/ryanhungate/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/update-users-with-additional-field/#post-15807078)
 * Status: resolved