Mailchimp programatic subscription and updates of existing users I'm using Mailchimp module for user registration and at this page I found a function for registering users programatically:

mailchimp_subscribe (
    $list_id,
    $email,
    array (
        'EMAIL' =&gt; $email,
        'FNAME' =&gt; $first_name, // fields in your mailchimp list
        'LNAME' =&gt; $last_name,
    ),
    false,
    false
)


In my mailchimp account I have defined new field of radio buttons type (field name 'type' with options 'client' and 'expert').

I have 2 questions:


How should be the 'type' column in mailchimp_subscribe() function specified?
How could be an existing user in mailchimp programatically updated?
The key in the array can be MERGEX (where Xth field number in MailChimp) or whatever custom tag name you've set in MailChimp (it shows up as *|TAGNAME|*" in MailChimp field settings) . The MailChimp dropdown user fields aren't like Drupal's (with select fields containing a key/value pair); all it needs is the literal display value of option. 

mailchimp_subscribe() eventually calls MailchimpLists::addOrUpdateMember() in its dependent library. Thus, the logic of adding/updating is handled for you in the function.

To put that together in the above code snippet:

mailchimp_subscribe(
    $list_id,
    $email,  //Will add or update $email in $list_id based on subscriber status
    array (
        'EMAIL' =&gt; $email,
        'FNAME' =&gt; $first_name, // fields in your mailchimp list
        'LNAME' =&gt; $last_name,
        // Assuming the 'type' field in MailChimp is your 3rd field 
        'MERGE3' =&gt; 'client',
    ),
    false,
    false
);