Tips and Tricks HQ Support Portal › Forums › WP Affiliate Platform › WP Affiliate Tweaks › Integrate WP Affiliate with different mailing list service
- This topic has 6 replies, 2 voices, and was last updated 12 years, 6 months ago by admin.
-
AuthorPosts
-
March 25, 2012 at 5:17 am #5919ArtisantopiaMember
HI. I need to integrate WP Affiliate with Constant Contact. I know you only support Mailchimp, Aweber and GetResponse but there must be a way I can hook into Constant Contact’s API whenever a new affiliate signs up.
I can’t see anywhere in the Affiliate settings that triggers an API call on sign up – am I missing it or is there a different way to approach this?
thanks in advance for all your help!
March 25, 2012 at 11:41 pm #43372adminKeymasterCheck the “Some info for the developers to help with custom integration” section from the following post:
March 27, 2012 at 8:48 am #43373ArtisantopiaMemberExcellent – I’ll work through that.
Thanks!
May 2, 2012 at 11:17 am #43374ArtisantopiaMemberHI! Finally getting back to this – plus I now want to integrate it with eStore and WP Affiliate. I read through that article and I understand the concept of what is required, but I’m unsure about how to actually make it work. I know enough php to understand what a function does, but not necessarily how to write my own! (in other words – I know enough to get myself into trouble, but not out of it!).
I’ve read through Constant Contact’s developer information and just got even more confused. But basically, my understanding is that they provide code samples you can use as a starting point to develop custom integrations.
I found this code sample that may be what I need (add-contact.php):
<?php
header('Content-Type: text/html; charset=UTF-8');
include_once('cc_class.php');
$ccContactOBJ = new CC_Contact();
$ccListOBJ = new CC_List();
$disabled = null;
//get all available lists for the current CC account.
$allLists = $ccListOBJ->getLists();
//get all available states
$allStates = $ccContactOBJ->getStates();
//get all available countries
$allCountries = $ccContactOBJ->getCountries();
/**
* If we have post fields means that the form have been submitted.
* Therefore we start submiting inserted data to ConstantContact Server.
*/
try {
if(isset($_POST["state"]) && isset($_POST["state_name"]))
{
if($_POST["state"] != "" && $_POST["state_name"] != "")
{
$_POST["state_name"] = "";
echo "<h1><center>State Other was erased to prevent errors on submission</center></h1>";
}
else {
}
}
if (!empty($_POST)) {
$postFields = array();
$postFields["email_address"] = $_POST["email_address"];
$postFields["first_name"] = $_POST["first_name"];
$postFields["last_name"] = $_POST["last_name"];
$postFields["middle_name"] = $_POST["middle_name"];
$postFields["company_name"] = $_POST["company_name"];
$postFields["job_title"]= $_POST["job_title"];
$postFields["home_number"] = $_POST["home_num"];
$postFields["work_number"] = $_POST["wrk_num"];
$postFields["address_line_1"] = $_POST["adr_1"];
$postFields["address_line_2"] = $_POST["adr_2"];
$postFields["address_line_3"] = $_POST["adr_3"];
$postFields["city_name"] = $_POST["city"];
$postFields["state_code"] = $_POST["state"];
// The Code is looking for a State Code For Example TX instead of Texas
$postFields["state_name"] = $_POST["state_name"];
$postFields["country_code"] = $_POST["country"];
$postFields["zip_code"] = $_POST["postal_code"];
$postFields["sub_zip_code"] = $_POST["sub_postal"];
$postFields["notes"] = $_POST["notes"];
if(isset($_POST["mail_type"]))
{
$postFields["mail_type"] = $_POST["mail_type"];
}
else
{
$postFields["mail_type"] = "HTML";
}
if(isset($_POST["lists"]))
{
$postFields["lists"] = $_POST["lists"];
}
else
{
throw new Exception("You are missing your list");
}
$postFields["custom_fields"] = array();
foreach($_POST as $key=>$val) {
if (strncmp($key, 'custom_field_', strlen('custom_field_')) === 0) {
$postFields["custom_fields"][substr($key, strlen('custom_field_'), strlen($key)-1)] = $val;
}
}
$contactXML = $ccContactOBJ->createContactXML(null,$postFields);
if (!$ccContactOBJ->addSubscriber($contactXML)) {
$error = true;
} else {
$error = false;
$_POST = array();
}
}
} catch (Exception $e) {
echo "<span style='color:red;'>" . $e . "</span>";
}
?>
<?php include_once('header.php'); ?>
<div align="center" style="width: 900px;">
<h2>Add a new Subscriber - Full form</h2>
<?php
//
// Here we add an area where messages are displayed (error or success messages).
//
if (isset($error)) {
if ($error === true) {
$class = "error";
$message = $ccContactOBJ->lastError;
} else {
$class = "success";
$message = "Contact ".htmlspecialchars($postFields["email_address"], ENT_QUOTES, 'UTF-8')." Added.";
}
echo '<div class="'.$class.'">';
echo $message;
echo '</div>';
}
?>
<form action="" method="post">
<?php
if($ccContactOBJ->contact_lists && !$ccContactOBJ->show_contact_lists && $ccContactOBJ->force_lists){
foreach ($allLists as $k=>$item) {
echo '<input type="hidden" name="lists[]" value="'.$item['id'].'" id="chk_'.$k.'" />';
}
} else {
?>
<div style="float: right; text-align: left; overflow: auto; height: 640px; width:250px;">
<fieldset>
<legend> Interests list </legend>
<?php
foreach ($allLists as $k=>$item) {
$checked = '';
if (isset($_POST['lists'])){
if (in_array($item['id'],$_POST['lists'])) {
$checked = ' checked ';
}
}
if($ccContactOBJ->force_lists && $ccContactOBJ->show_contact_lists){
echo '<input type="hidden" name="lists[]" value="'.$item['id'].'" id="chk_'.$k.'" /><label for="chk_'.$k.'">'.$item['title'].'</label><br />';
}
// else {
// echo '<input type="checkbox" '.$checked . $disabled .' class="checkbox" name="lists[]" value="'.$item['id'].'" id="chk_'.$k.'" /> <label for="chk_'.$k.'">'.$item['title'].'</label><br/>';
// }
else {
echo '<input type="checkbox" class="checkbox" name="lists[]" value="'.$item['id'].'" id="chk_'.$k.'" /> <label for="chk_'.$k.'">'.$item['title'].'</label><br/>';
}
}
?>
</fieldset>
</div>
<?php } ?>
<div>
<h3>Contact information</h3>
<table width="580" border="0" cellpadding="2" cellspacing="0">
<tr>
<td align="left">Email Address:</td>
<td align="left"><input type="text" name="email_address" maxLength="50" value="<?php
if (isset($_POST['email_address']))
{
echo htmlspecialchars($_POST['email_address'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left"> </td>
<td align="left"> </td>
</tr>
<tr>
<td align="left">First Name:</td>
<td align="left"><input type="text" name="first_name" maxLength="50" value="<?php
if (isset($_POST['first_name']))
{
echo htmlspecialchars($_POST['first_name'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left">Last Name:</td>
<td align="left"><input type="text" name="last_name" maxLength="50" value="<?php
if (isset($_POST['last_name']))
{
echo htmlspecialchars($_POST['last_name'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
</tr>
<tr>
<td align="left">Middle Name:</td>
<td align="left"><input type="text" name="middle_name" maxLength="50" value="<?php
if (isset($_POST['middle_name']))
{
echo htmlspecialchars($_POST['middle_name'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left">Home phone:</td>
<td align="left"><input type="text" name="home_num" maxLength="50" value="<?php
if (isset($_POST['home_num']))
{
echo htmlspecialchars($_POST['home_num'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
</tr>
<tr>
<td align="left" valign="top">Address:</td>
<td align="left" colspan="3">
<input type="text" name="adr_1" maxLength="50" style="width: 440px" value="<?php
if (isset($_POST['adr_1']))
{
echo htmlspecialchars($_POST['adr_1'], ENT_QUOTES, 'UTF-8');
}
?>" /><br/>
<input type="text" name="adr_2" maxLength="50" style="width: 440px" value="<?php
if (isset($_POST['adr_2']))
{
echo htmlspecialchars($_POST['adr_2'], ENT_QUOTES, 'UTF-8');
}
?>" /><br/>
<input type="text" name="adr_3" maxLength="50" style="width: 440px" value="<?php
if (isset($_POST['adr_3']))
{
echo htmlspecialchars($_POST['adr_3'], ENT_QUOTES, 'UTF-8');
}
?>" /><br/>
</td>
</tr>
<tr>
<td align="left">City:</td>
<td align="left"><input type="text" name="city" maxLength="50 value="<?php
if (isset($_POST['city']))
{
echo htmlspecialchars($_POST['city'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left">State:</td>
<td align="left">
<select name="state">
<option value=""> </option>
<?php
foreach ($allStates as $stateCode=>$stateName) {
$selected = '';
if ($stateCode == $_POST['state']) {
$selected = ' selected ';
}
echo '<option value="'.$stateCode.'" '.$selected.'>'.$stateName.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td align="left">Zip:</td>
<td align="left"><input type="text" name="postal_code" maxLength="25" value="<?php
if (isset($_POST['postal_code']))
{
echo htmlspecialchars($_POST['postal_code'], ENT_QUOTES, 'UTF-8');
}
?>"/></td>
<td align="left">State (Other):</td>
<td align="left"><input type="text" name="state_name" maxLength="50" value="<?php
if(isset($_POST['state_name'])){
echo htmlspecialchars($_POST['state_name'], ENT_QUOTES, 'UTF-8');
} ?>"/></td>
</tr>
<tr>
<td align="left">Sub-zip:</td>
<td align="left"><input type="text" name="sub_postal" maxLength="25" value="<?php
if (isset($_POST['sub_postal']))
{
echo htmlspecialchars($_POST['sub_postal'], ENT_QUOTES, 'UTF-8');
}
?>"/></td>
<td align="left">Country:</td>
<td align="left">
<select name="country">
<option value=""> </option>
<?php
foreach ($allCountries as $countryCode=>$countryName) {
$selected = '';
if ($countryCode == $_POST['country']) {
$selected = ' selected ';
}
echo '<option value="'.$countryCode.'" '.$selected.'>'.$countryName.'</option>';
}
?>
</select>
</td>
<td colspan="2"></td>
</tr>
<tr>
<td align="left">E-Mail Type:</td>
<td align="left" colspan="3">
<input type="radio" class="checkbox" name="mail_type" id="mt1" value="HTML" <?php
if (isset($_POST['mail_type']))
{
echo ($_POST['mail_type']=='HTML' || empty($_POST['mail_type']))?' checked ':
'';
}
?> />
<label for="mt1">HTML</label>
or
<input type="radio" class="checkbox" name="mail_type" id="mt2" value="Text" <?php
if (isset($_POST['mail_type']))
{
echo ($_POST['mail_type']=='Text')?' checked ':
'';
}
?> />
<label for="mt2">Text</label>
</td>
</tr>
</table>
<h3>Work details</h3>
<table width="580" border="0" cellpadding="2" cellspacing="0">
<tr>
<td align="left">Company Name:</td>
<td align="left"><input type="text" name="company_name" maxLength="50" value="<?php
if (isset($_POST['company_name']))
{
echo htmlspecialchars($_POST['company_name'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left">Job Title:</td>
<td align="left"><input type="text" name="job_title" maxLength="50" value="<?php
if (isset($_POST['job_title']))
{
echo htmlspecialchars($_POST['job_title'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
</tr>
<tr>
<td align="left">Work phone:</td>
<td align="left"><input type="text" name="wrk_num" maxLength="50" value="<?php
if (isset($_POST['wrk_num']))
{
echo htmlspecialchars($_POST['wrk_num'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td colspan="2"></td>
</tr>
</table>
<h3>Custom Fields & Notes</h3>
<table width="580" border="0" cellpadding="2" cellspacing="0">
<tr>
<td align="left">Custom Field 1:</td>
<td align="left"><input type="text" name="custom_field_1" maxLength="50" value="<?php
if (isset($_POST['custom_field_1']))
{
echo htmlspecialchars($_POST['custom_field_1'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left">Custom Field 2:</td>
<td align="left"><input type="text" name="custom_field_2" maxLength="50" value="<?php
if (isset($_POST['custom_field_2']))
{
echo htmlspecialchars($_POST['custom_field_2'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
</tr>
<tr>
<td align="left">Custom Field 3:</td>
<td align="left"><input type="text" name="custom_field_3" maxLength="50" value="<?php
if (isset($_POST['custom_field_3']))
{
echo htmlspecialchars($_POST['custom_field_3'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left">Custom Field 4:</td>
<td align="left"><input type="text" name="custom_field_4" maxLength="50" value="<?php
if (isset($_POST['custom_field_4']))
{
echo htmlspecialchars($_POST['custom_field_4'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
</tr>
<tr>
<td align="left">Custom Field 5:</td>
<td align="left"><input type="text" name="custom_field_5" maxLength="50" value="<?php
if (isset($_POST['custom_field_5']))
{
echo htmlspecialchars($_POST['custom_field_5'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left">Custom Field 6:</td>
<td align="left"><input type="text" name="custom_field_6" maxLength="50" value="<?php
if (isset($_POST['custom_field_6']))
{
echo htmlspecialchars($_POST['custom_field_6'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
</tr>
<tr>
<td align="left">Custom Field 7:</td>
<td align="left"><input type="text" name="custom_field_7" maxLength="50" value="<?php
if (isset($_POST['custom_field_7']))
{
echo htmlspecialchars($_POST['custom_field_7'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left">Custom Field 8:</td>
<td align="left"><input type="text" name="custom_field_8" maxLength="50" value="<?php
if (isset($_POST['custom_field_8']))
{
echo htmlspecialchars($_POST['custom_field_8'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
</tr>
<tr>
<td align="left">Custom Field 9:</td>
<td align="left"><input type="text" name="custom_field_9" maxLength="50" value="<?php
if (isset($_POST['custom_field_9']))
{
echo htmlspecialchars($_POST['custom_field_9'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left">Custom Field 10:</td>
<td align="left"><input type="text" name="custom_field_10" maxLength="50" value="<?php
if (isset($_POST['custom_field_10']))
{
echo htmlspecialchars($_POST['custom_field_10'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
</tr>
<tr>
<td align="left">Custom Field 11:</td>
<td align="left"><input type="text" name="custom_field_11" maxLength="50" value="<?php
if (isset($_POST['custom_field_11']))
{
echo htmlspecialchars($_POST['custom_field_11'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left">Custom Field 12:</td>
<td align="left"><input type="text" name="custom_field_12" maxLength="50" value="<?php
if (isset($_POST['custom_field_12']))
{
echo htmlspecialchars($_POST['custom_field_12'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
</tr>
<tr>
<td align="left">Custom Field 13:</td>
<td align="left"><input type="text" name="custom_field_13" maxLength="50" value="<?php
if (isset($_POST['custom_field_13']))
{
echo htmlspecialchars($_POST['custom_field_13'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left">Custom Field 14:</td>
<td align="left"><input type="text" name="custom_field_14" maxLength="50" value="<?php
if (isset($_POST['custom_field_14']))
{
echo htmlspecialchars($_POST['custom_field_14'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
</tr>
<tr>
<td align="left">Custom Field 15:</td>
<td align="left"><input type="text" name="custom_field_15" maxLength="50" value="<?php
if (isset($_POST['custom_field_15']))
{
echo htmlspecialchars($_POST['custom_field_15'], ENT_QUOTES, 'UTF-8');
}
?>" /></td>
<td align="left"></td>
<td align="left"></td>
</tr>
<tr>
<td align="left">Notes:</td>
<td align="left" colspan="3">
<textarea rows="10" cols="50" name="notes"><?php
if (isset($_POST['notes']))
{
echo htmlspecialchars($_POST['notes'], ENT_QUOTES, 'UTF-8');
}
?></textarea>
</td>
</tr>
<tr>
<td align="center" colspan="4">
<input type="submit" name="submit" value="Add Contact" />
</td>
</tr>
</table>
</div>
</form>
</div>
</body>
</html>So would I just need to call this file from the eStore_global_autoresponder_signup function of eStore_auto_responder_handler.php?
But how exactly (i.e. step by step) do I go about doing this?
Also, I contacted CC and they suggested having you contact them to work together on an integration – you can see the conversation here: http://community.constantcontact.com/t5/Getting-Started-with-API-s/Integrating-with-Tips-and-Tricks-eStore-WordPress-Plugin/td-p/51859
I have done quite a bit of research and downloaded other code samples, please let me know if you need me to send you anything else.
I understand this is asking quite a bit for your assistance in setting this up, but I will be so grateful for any help you can provide.
Thank you!!!
May 2, 2012 at 11:19 am #43375ArtisantopiaMemberGosh – just realised how much code that was!!! I put it in backticks, but I don’t think it worked
Sorry – hope this is ok?
May 6, 2012 at 2:22 am #43376ArtisantopiaMemberbumping this – I really need to get this sorted as the site goes live very soon.
Thanks – look forward to hearing from you.
May 6, 2012 at 4:06 am #43377adminKeymasterThe autoresponder you are using is not one of our advertised autoresponders that we support for this plugin.
Please read the 3rd point from our forum rules which will explain the details:
https://support.tipsandtricks-hq.com/forums/topic/forum-rules
If you need a custom job done then contact us using the contact form of our site.
-
AuthorPosts
- You must be logged in to reply to this topic.