简体   繁体   中英

Mailchimp api v1.1 listUpdateMember how to send checkbox fields?

Ok I know it's dated but it's a legacy plugin I need to update.

I am trying to use the listUpdateMember to update a checkbox field in mailchimp. I have the normal merge_vars updating FNAME, LNAME etc but the GROUPINGS one does nothing and returns no errors. My last attempt at this was to create a manual array

$group = [array('id' => '3525', 'name' => 'Interests', 'groups' => array('General', 'Education'))];

Assign this to $merge_vars['GROUPINGS'] and then send it via the created api

$api->listUpdateMember($listId, $email, $merge_vars);

As I said the other fields get updated but not the interests checkbox group.

So my main problem is knowing what the GROUPINGS variable is expecting as an array if someone could set it out as a php array I can then re-create this from my form fields.

Any help much appreciated.

Eventually worked this out myself after lots of head scratching not helped by an annoying browse cache!

'GROUPINGS'=>array(
                array( 'groups' => 'comma, separated, list, of, options', 'id' => '[groupId]' )   
            )

[groupId] can be found by calling yourApiModel->listInterestGroupings($listId)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM