Jan 19th, 2012, 1:32 PM
I seem to have found a way to get this working with Campaign Monitor, I hope it's not too much of a hack since i am just learning.
the key was this thread
http://forums.formtools.org/showthread.php?tid=1442
which describes the Submission Pre-Parser module:
http://modules.formtools.org/submission_pre_parser/
the Submission Pre-Parser module lets you add a rule and some php code that is executed when the form is submitted.
mine got a little complicated because we have multiple language sites sharing the same templates but going to different subscriber lists so i had to add hidden values to the forms, but the basic php that i added to the Submission Pre-Parser module was this:
require_once('CMBase.php');
$api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$client_id = null;
$campaign_id = null;
$list_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$cm = new CampaignMonitor( $api_key, $client_id, $campaign_id, $list_id );
$FirstName = $_POST["FirstName"];
$LastName = $_POST["LastName"];
$name = $FirstName . " " . $LastName;
$email = $_POST["Email"];
if ($_POST["Subscribe"] == "1" ) {
$result = $cm->subscriberAdd($email, $name);
}
the top part is straight from the campaign monitor api so that might not apply if you a different email service, then i got the values from my form, then check if the "Subscribe"checkbox is checked, then send to cm
Don't know if this helps or not.
the key was this thread
http://forums.formtools.org/showthread.php?tid=1442
which describes the Submission Pre-Parser module:
http://modules.formtools.org/submission_pre_parser/
the Submission Pre-Parser module lets you add a rule and some php code that is executed when the form is submitted.
mine got a little complicated because we have multiple language sites sharing the same templates but going to different subscriber lists so i had to add hidden values to the forms, but the basic php that i added to the Submission Pre-Parser module was this:
require_once('CMBase.php');
$api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$client_id = null;
$campaign_id = null;
$list_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$cm = new CampaignMonitor( $api_key, $client_id, $campaign_id, $list_id );
$FirstName = $_POST["FirstName"];
$LastName = $_POST["LastName"];
$name = $FirstName . " " . $LastName;
$email = $_POST["Email"];
if ($_POST["Subscribe"] == "1" ) {
$result = $cm->subscriberAdd($email, $name);
}
the top part is straight from the campaign monitor api so that might not apply if you a different email service, then i got the values from my form, then check if the "Subscribe"checkbox is checked, then send to cm
Don't know if this helps or not.