PHP Call to "Add an opt-in checkbox for other lists"


I'm using the to add people to my mailing list(s), including the function Subscriber.AddWithCustomFields.

Everything is working great, but I'd like to also pass the variable "Checked" or "On" through the call to activate the function of "Add an opt-in checkbox for other lists", just as the form builder allows me to do.

I've tried this, and it passes everything except my last variable.

$cm->subscriberAddWithCustomFields('', 'John Doe', array('Phone'=>'(123) 123-1234', 'Company' => 'ABC Widgets', 'Other List' => 'On'));

Does anyone know how to do this?

Phil Phil, 7 years ago

Hi mibrenenr,

It looks like you're attempting to use Subscriber.AddWithCustomFields to subscribe an individual to more than one list, however that's not the purpose of that procedure. If you want to use the API to subscribe to more than one list, you'll need to make a call to the API for each list they'd like to be a member of.

For example (this example assumes that the custom fields from the first list DON'T apply in the third but DO apply in the second)

$cm->subscriberAddWithCustomFields('', 'John Doe', $customFieldsArray, $listID_1);
$cm->subscriberAddWithCustomFields('', 'John Doe', $customFieldsArray, $listID_2);
$cm->subscriberAdd('', 'John Doe', $listID_3);

Hope that helps.

Join 150,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free