Search code examples
drupal-6drupal-webform

Drupal - Subscribing to email list via webform module


I want to use the Drupal modules Webform and Email Marketing Framework to allow anonymous users to fill out a short contact form and then be subscribed via the campaignmonitor API to a list.

So far my process idea is as follows, and I'm interested to see if anyone can think of a more streamlined approach?

  1. Webform submission interrupted using hook_form_alter()
  2. Form data extracted (Name, email address)
  3. actions_do() called to fire action with an AID of 2. Action AID2 is instance of emf_subscribe_action()
  4. Pass form data as appropriate and let EMF do the work communicating with campaign monitor.

As I see it this approach allows me to set up a system which can be administrated all on-site without the need for PHP development. I'm reckoning on setting a certain content type, enabling webforms on it, and then each time a user creates one of these webforms, the action can be called.


Solution

  • The answer was to use Webform to create the form and then the EMF module to perform the campaign monitor integration. I had to create a custom module to intercept the submission of the particular form and fire off the email request. I also had to write the details to a CSV, so that's the extra chunk of code here.

    Here's the meat of the module just in case anyone else need this in the future: http://drupal.org/node/1022916