This page explains the cForms plugin integrating with the WP Affiliate Software to design a Pay Per Lead Affiliate Model.
This instruction is best suited for someone with PHP Coding Knowledge. Please follow one of the following integration instructions:
i) Integration Option 1
This integration was documented by Sean Conway from 499sitedesign.com
All i needed to do was follow the instructions @ cform II for using the my-functions.php file (i used the override location) and include this code. To use this code you may need to change [‘Email *’] and [‘Your Name *’] to match the field titles in the form. I have included some comments to help.
ii) Integration Option 2
This integration was done and documented by Yvette Kwei from magnumip.com.au
Little Background
I created a form with the popular Cforms II plugin (version 11.1).
In my form, users enter their contact details and then choose between one of four packages that I offer (“Basic”, “Standard”, “Premium” and “Custom”). Each package has a different price (in this example, $95, $195, $295, and $395). I wanted to pay my Affiliates for sending me these leads. Further, I wanted the “Unique Transaction ID” in WP Affiliate to be the ID given by Cforms to the particular submission.
The Integration Steps
1. Insert the following code into the “my-functions.php” file within cForms:
##### Start code here:
function my_cforms_action($cformsdata) { if (!empty($_SESSION['ap_id'])) $referrer = $_SESSION['ap_id']; else if (isset($_COOKIE['ap_id'])) $referrer = $_COOKIE['ap_id']; if (!empty($referrer)) { $email = $cformsdata['data']['Email']; $txnid = $cformsdata['subid']; $itemid = 'Unknown'; $amount = 0.0; $item = $cformsdata['data']['Type of Service']; if (strpos($item, 'Basic') === 0) { $amount = 95.0; $itemid = 'Basic'; } else if (strpos($item, 'Standard') === 0) { $amount = 195.0; $itemid = 'Standard'; } else if (strpos($item, 'Premium') === 0) { $amount = 295.0; $itemid = 'Premium'; } else if (strpos($item, 'Custom') === 0) { $amount = 395.0; $itemid = 'Custom'; } wp_aff_award_commission($referrer, $amount, $txnid, $itemid, $email); } }
##### End Code here.
2. Insert a single line of code in “../wp-content/plugins/cforms/lib_nonajax.php”:
### ### allow the user to use form data for other apps ### $trackf['id'] = $no; $trackf['subid'] = $subID; ###### <<--- Insert this line here ##### $trackf['data'] = $track; if( function_exists('my_cforms_action') ) my_cforms_action($trackf);
Notes:
- Cforms v.11.1 allows you to place the “my-functions.php” file in a folder called “cforms-custom” rather than “cforms” itself. This allows you to protect your custom scripts from being over-written when upgrading cforms. If you’ve taken advantage of this option (recommended) make sure the code you insert in step 1 is in the “../wp-content/plugins/cforms-custom/lib_nonajax.php” file.
- Obviously, you can rename the packages to whatever you want, and set the prices to whatever you want, but if you change the packages, you’ll need to manually update the data in the “my-functions.php” file.
- If you upgrade Cforms, you’ll need to re-insert the code in the lib_nonajax.php file.
Leave a Reply