If you’re using Affiliates Pro, and Infusionsoft, you might want to tag the Infusionsoft contact for an affiliate, once they have signed up.
Here’s a handy function to do that.
Important: You need to installed the Infusionsoft SDK plugin first (or add the SDK to your theme yourself).
// Affiliate added
add_action( 'affiliates_added_affiliate', 'my_affiliates_added_affiliate' );
function my_affiliates_added_affiliate( $affiliate_id ) {
global $wpdb;
$groupid = 1601; // Set your tag id from Infusionsoft
// Get the AffiliatesPro details from WP
$affiliate = $wpdb->get_results("SELECT * FROM wp_aff_affiliates WHERE affiliate_id = $affiliate_id");
$affiliate = current($affiliate);
// Get the contact details from InfusionSoft
$contacts = Infusionsoft_DataService::query(new Infusionsoft_Contact(), array('Email' => $affiliate->email));
$found = array_shift($contacts);
$contactID = $found->Id;
// Got it
// Add the tag in Infusionsoft
Infusionsoft_ContactService::addToGroup($contactID, $groupid);
}