{"id":82,"date":"2019-10-07T11:37:30","date_gmt":"2019-10-07T10:37:30","guid":{"rendered":"http:\/\/www.freelancewp.guide\/?p=82"},"modified":"2019-10-07T11:37:30","modified_gmt":"2019-10-07T10:37:30","slug":"assign-a-tag-to-a-contact-in-infusionsoft-using-affiliates-pro","status":"publish","type":"post","link":"https:\/\/freelancewp.guide\/assign-a-tag-to-a-contact-in-infusionsoft-using-affiliates-pro\/","title":{"rendered":"Assign a Tag to a Contact in Infusionsoft using Affiliates Pro"},"content":{"rendered":"\n

If you\u2019re using Affiliates Pro, and Infusionsoft, you might want to tag the Infusionsoft contact for an affiliate, once they have signed up.<\/p>\n\n\n\n

Here\u2019s a handy function to do that.<\/p>\n\n\n\n

Important: You need to installed the Infusionsoft SDK plugin<\/a> first (or add the SDK to your theme yourself).<\/p>\n\n\n\n

\/\/ Affiliate added\nadd_action( 'affiliates_added_affiliate', 'my_affiliates_added_affiliate' );\nfunction my_affiliates_added_affiliate( $affiliate_id ) {\n\n\u00a0\u00a0global $wpdb;\n\n\u00a0\u00a0$groupid = 1601; \/\/ Set your tag id from Infusionsoft\n\n\u00a0\u00a0\/\/ Get the AffiliatesPro details from WP\n\u00a0\u00a0$affiliate = $wpdb->get_results(\"SELECT * FROM wp_aff_affiliates WHERE affiliate_id = $affiliate_id\");\n\u00a0\u00a0$affiliate = current($affiliate);\n\n\u00a0\u00a0\/\/ Get the contact details from InfusionSoft\n\u00a0\u00a0$contacts = Infusionsoft_DataService::query(new Infusionsoft_Contact(), array('Email' =>\u00a0\u00a0 $affiliate->email));\n\u00a0\u00a0$found = array_shift($contacts);\n\n\u00a0\u00a0$contactID = $found->Id;\n\n\u00a0\u00a0\/\/ Got it\n\n\u00a0\u00a0\/\/ Add the tag in Infusionsoft\n\u00a0\u00a0Infusionsoft_ContactService::addToGroup($contactID, $groupid);\n\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

If you\u2019re using Affiliates Pro, and Infusionsoft, you might want to tag the Infusionsoft contact for an affiliate, once they have signed up. Here\u2019s a handy function to do that. Important: You need to installed the Infusionsoft SDK plugin first (or add the SDK to your theme yourself).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/posts\/82"}],"collection":[{"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/comments?post=82"}],"version-history":[{"count":0,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/posts\/82\/revisions"}],"wp:attachment":[{"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/media?parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/categories?post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/tags?post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}