Add users to interest group via MailChimp API v2.0

随声附和 提交于 2019-12-03 14:03:08
Sacha

Well, I figured it out.

Although I could have sworn I'd already tried it this way... the groups have to be an array, even for a single group.

My code now:

$merge_vars = array(
    'GROUPINGS'=> array(
        array(
            'id' => 17385,
            'groups' => array($post['listName'])
        )
    )
);

$mc->lists->updateMember(self::$mainListID, $email, $merge_vars);

Works perfectly.

For me works using name instead of id group.

$merge_vars = array(
    'groupings'=> array(
        array(
            'name' => 'Group Name',
            'groups' => array('Group item name')
        )
    )
);

Agree with @Sanaco

add this example for more checkboxes

$option1=$_POST['xxxx'];
$option2=$_POST['xxxx'];
$option3=$_POST['xxxx'];

'GROUPINGS'=> array(
                            array(
                                'id' => 123456,
                                'groups' => array($option1, $option2, $option3)
                            )
                        )
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!