I'm using the http://www.campaignmonitor.com/api/kits/#php-sample 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('email@example.com', 'John Doe', array('Phone'=>'(123) 123-1234', 'Company' => 'ABC Widgets', 'Other List' => 'On'));
Does anyone know how to do this?
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('firstname.lastname@example.org', 'John Doe', $customFieldsArray, $listID_1); $cm->subscriberAddWithCustomFields('email@example.com', 'John Doe', $customFieldsArray, $listID_2); $cm->subscriberAdd('firstname.lastname@example.org', 'John Doe', $listID_3);
Hope that helps.
From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that drive real business results.Get started for free