Hiya,
I'm writing a custom module so that when an anonymous user fills out a webform subscription form, he/she can be subscribed to a specified campaign monitor list.
I've got all the information contained in variables ready to be used with the emf_campaign_monitor_api_subscribe function ie:
$email = $submission->data[$mapping['email_address_no_events']]['value'][0];
$fields = array('Name' => $submission->data[$mapping['name']]['value'][0], 'Location' => $submission->data[$mapping['location']]['value'][0]);
$lid = "5DKDS12CA4B70AE";
emf_campaign_monitor_api_subscribe($email, $fields, $lid);
drupal_set_message(t('Subscribed'));
But I can't figure out how to get this function firing and actually working! So far it just sits there dead in the water and I can't find any documentation or posts on this matter.
Can anyone give me a pointer or two?
Thanks
Comments
Comment #1
davyvdb commentedYou shouldn't use the cm functions directly, rather use the emf wrapper functions. This will make your implementation work with all plugins.
To subscribe someone, use emf_db_save_request
This will queue a request. Run cron and your subscription should be done.
Comment #2
hfidge commentedAhh of course - great thank you very much. If anyone is interested here's my module code to pick up the submission out of the webform and subscribe the user.
Comment #3
davyvdb commented