AffiliatorVersion 1.18
Affiliator lets you generate and track affiliate links, manage affiliates and pay commissions on purchases made through CartThrob and/or Brilliant Retail. You can set individual commission levels per affiliate id. You can set multiple affiliate IDs per member, and membership is not required to be an affiliate. If an affiliate is a member, the member account will be tied to the affiliate ID and the affiliate settings in the backend will allow you direct access to the member information.
Affiliator allows you to handle all affiliate operations on the backend, but gives you tags to handle most of these operations in standard templates as well. Operations like creating and updating affiliates generating affiliate links can all be done in front end templates, so that you can build an affiliate portal to suit your needs.
- Requirements
- Installation
- Upgrading
- Settings
- Tags
- Global Form Parameters
- Troubleshooting
- PayPal MassPay Edition
- Developers
Requirements
- ExpressionEngine 2.2+
- PHP 5.1.6+
Installation
- Upload the /system/expressionengine/third_party/affiliator/ folder to /system/expressionengine/third_party/
- Make sure Extensions are enabled on your system
- Install the Affiliator module and extension
- If you'd like members or guests to be able register as affiliates or track commissions, refer to the sample template code, and create your templates accordingly.
Upgrading
- Upload the /system/expressionengine/third_party/affiliator/ folder to /system/expressionengine/third_party/ Overwriting existing files.
- Go to EE settings » addons » and click "Run Module Updates"
Settings

Affiliator Settings Screenshot
Backend Settings
There are several pages of settings. Most are fairly self explanatory, but they're covered here briefly
Instructions Form Email Content
When an affiliate requests an email with their affiliate link, this is the content they will receive
PayPal Settings
Payments can be sent to affiliates based on their referral bonuses. When PayPal account information is added, it simplifies the commission payment process.
New Affiliate and Admin Notifications
These settings panes control the email content that is sent to an Admin or a New Affiliate upon signup. You can use standard EE template code in these templates, along with custom variables (listed in the settings). You can also embed EE templates ({embed="your_template_group/your_template"}).
Affiliates
This lists the affiliates currently registered to your site. The following pieces of information are listed:
- Affiliate ID
- example affiliate link
- Member (if any; affiliates don't have to be tied to members)
- Status (statuses are arbitrary identifiers of groups of affiliates)
- Commission percentage (each member can have a unique percentage)
- PayPal ID
- PayPal payment link (payment amount is not preset)
- Hits
- Unpaid Commissions
- Edit link
- Payment link (this will pay the affiliate all unpaid commission, only available with MassPay edition of Affiliator)
- Delete affiliate link
- Pay open commissions with PayPal MassPay button (Pays all open commissions; only available on MassPay edition of Affiliator)
Add Affiliate
Allows you to create an affiliate. Affiliates can also be created in EE templates. If you don't allow affiliates to self register, then you'll need to add them manually here.
Conversions
Orders that have been completed and the relevant commission for that order. This page lists:
- Affiliate ID
- Member name and ID
- Link to member profile
- Commission
- Order ID
- Order date
Payments
This page lists payments that have been processed using the "Pay" link on the affiliates page. This page shows:
- Affiliate ID
- Member and member ID
- Payment amount
- MassPay Correlation ID
- Payment date
- Pay open commissions with PayPal MassPay button (Pays all open commissions; only available on MassPay edition of Affiliator)
CartThrob Settings
If CartThrob is installed, Affiliator will list additional settings for it.
- Setting to save affiliate ids to orders
- Affiliate ID channel field
- Affiliate Email content. This is content you want emailed to affiliates when a purchase has been made.
BrilliantRetail Settings
If BrilliantRetail is installed, Affiliator will list additional settings for it.
- Affiliate Email content. This is content you want emailed to affiliates when a purchase has been made.
Tags
- Link
- Email Instructions Form
- Create Affiliate Form
- Update Affiliate Form
- Current Affiliate
- List Affiliates
- Payments
- Status List
- Hits
- Trigger
Affiliates
Generates a list of affiliates.
Parameters
- affiliate_id="the_affiliate_id" If this is left blank, then all affiliates will be shown (do not use in conjunction with member_id)
- member_id="123" If this is left blank, then all affiliates will be shown (do not use in conjunction with affiliate_id)
- limit="1" The total number of affiliates to display
- offset="10"
- order_by="member_id"
Variables
- {affiliate_id}
- {affiliate_member_id}
- {status}
- {commission}
- {hits}
- {if no_results}none{/if}
Example
This will list all affiliates and their link
{exp:affiliator:affiliates}
{affiliate_id}
{affiliate_member_id}
{status}
{commission}
{hits}
{if no_results}
none
{/if}
Affiliate link tag: {exp:affiliator:link affiliate_id="{affiliate_id}" page="/" }
{/exp:affiliator:affiliates}
This will list affiliate data for the currently logged in user
{exp:affiliator:affiliates
member_id="CURRENT_USER"
}
{affiliate_id}
{affiliate_member_id}
{status}
{commission}
{hits}
{if no_results}
none
{/if}
Affiliate link tag: {exp:affiliator:link affiliate_id="{affiliate_id}" page="/" }
{/exp:affiliator:affiliates}
Create Affiliate Form
This tag generates a form used to create an affiliate in a template.
Parameters
- affiliate_id="the_affiliate_id" (affiliates ID is either required as a parameter or as a form input)
- paypal_id=""
- percentage="10"
- status="closed"
- member_id="123" (if you want to assign the ID to a specific member)
- return="my_group/my_template" redirect URL
- secure_return="my_group/my_template" Secure redirect URL
All of these parameters are also form inputs
Form Inputs
- id The affiliate's ID; (affiliates ID is either required as a parameter or as a form input)
<input type="text" name="id" value="" />
- paypal_id The paypal id or email address of the affiliate
<input type="text" name="paypal_id" value="" />
- percentage
<input type="text" name="percentage" value="10" />
- status Any new status added here will be available as a status in the backend and in the status_list tag
<input type="text" name="status" value="closed" />
Example
{exp:affiliator:create_affiliate_form}
Affiliate Id: <input type="text" name="affiliate_id" value="" /><br />
Paypal ID <input type="text" name="paypal_id" value="" /> <br />
Percentage <input type="text" name="percentage" value="10" /> <br />
Status <input type="text" name="status" value="closed" />
<input type="submit" />
{/exp:affiliator:create_affiliate_form}
Update Affiliate Form
This allows you to update your affiliates in member templates, or allows them to update their own affiliate information
Parameters
- affiliate_id="the_affiliate_id" required
- status="closed"
- percentage="20"
- paypal_id="test@test.com"
- return="my_group/my_template" redirect URL
- secure_return="my_group/my_template" Secure redirect URL
All of these parameters are also form inputs
Form Inputs
- status Any new status added here will be available as a status in the backend and in the status_list tag. When using inputs, status is only editable by SuperAdmins (does not apply when using parameter).
<input type="text" name="status" value="closed" />
- paypal_id Any new status added here will be available as a status in the backend and in the status_list tag.
<input type="text" name="paypal_id" value="test@test.com" />
Example
{exp:affiliator:affiliates limit="2"}
{exp:affiliator:update_affiliate_form }
<input type="text" name="affiliate_id" value="{affiliate_id}" />
<input type="text" name="status" value="{status}" />
<input type="submit" />
{/exp:affiliator:update_affiliate_form}
{/exp:affiliator:affiliates}
Status List
Lists any statuses that have been created. Statuses is an arbitrary category that you can apply to an affiliate. The have no affect on the system and are purely informational
Variables
- {status}
Example
{exp:affiliator:status_list}
{status}
{/exp:affiliator:status_list}
Payments
Lists payments that have been made.
Parameters
- affiliate_id List payments to a specific affiliate. Useful for allowing affiliates to see completed payments
- member_id List payments to a specific member. Useful if the member has multiple affiliate IDs
- limit
- offset
- order_by
Variables
- {affiliate_id}
- {affiliate_member_id}
- {payment}
- {id}
- {date format="%Y %m %d %h"}
- {human_date}
- {transaction_id}
- {if no_results}none{/if}
Example
{exp:affiliator:payments}
{affiliate_id}
{affiliate_member_id}
{payment}
{id}
{date format="%Y %m %d %h"}
{human_date}
{transaction_id}
{if no_results}
none
{/if}
{/exp:affiliator:payments}
Current Affiliate
Outputs data about the current registered affiliate (based on affiliate id set in users cookie). You would use this tag to display affiliate information to a customer that clicked on the affiliates link. To display information to the affiliate themselves, use the affiliates tag.
Variables
- {affiliate_id}
- {affiliate_member_id}
- {affiliate_email}
- {percentage}
- {commission} (Current unpaid commission)
- {status}
- {if no_results}none{/if}
Example
{exp:affiliator:current_affiliate}
{affiliate_id}
{affiliate_member_id}
{affiliate_email}
{percentage}
{commission}
{status}
{if no_results}
an affiliate is not currently set
{/if}
{/exp:affiliator:current_affiliate}
Email Instructions Form
This will generate a form used to send a pre-formatted email to a specified email address. You create the content of this email in the backend settings, to combat spam, it is not editable in the template output. You can always use EE's send to a friend form or alternate method if you want the affiliate to have control over the message content.
Parameters
- affiliate_id="the_affiliate_id"
Variables
- {form_fields} Outputs all form fields required to send the email.
Form Inputs
You can use your own input fields rather than the form_fields variable if you'd prefer
- email_to required
<input type="text" name="email_to" value="" />
- email_to_name required
<input type="text" name="email_to_name" value="" />
- email_from required
<input type="text" name="email_from" value="" />
- email_from_name required
<input type="text" name="email_from_name" value="" />
Example
<p>Need to send the link to someone else? Enter their email address and hit submit.</p>
{exp:affiliator:email_instructions_form affiliate_id=""}
{form_fields}
{/exp:affiliator:email_instructions_form}
Link
Generates an affiliate link
Parameters
- {affiliate_id} if affiliate_id is blank, the last created id will be used if found. If not found, any active affiliate ID will be used
- {page} generates a page redirect link that can not be read (hashed)
- {return} generates a page redirect link that can be read. If set, page parameter will be used instead of return.
Example
<p>Copy the code below, and add it to your website to generate commissions by referring traffic to this site.</p>
<p>
<textarea name="affiliate_link" rows="3" cols="100" id="affiliate_link">
<a href='{exp:affiliator:link affiliate_id="" page="my_group/my_template" }'>Click here to visit: {site_url}</a>
</textarea>
</p>
Hits
Outputs the number of hits the current affiliate has registered
Parameters
- affiliate_id="the_affiliate_id" required
Example
{exp:affiliator:hits affiliate_id="some_id"}
Trigger
Triggers a commission. Be very careful with this tag, as this will register a commission every time this tag is parsed in a template. This can be a useful tool when affiliator is used for basic tracking, but if you intend to capture money commissions based on some user interaction, a custom extension that calls Affiliator's calculate_commission function will be much more secure.
Parameters
- total The total amount the commission should be based on (can be zero)
- order_id Any order id connected with this commission (can be left empty)
- send_email Any value here will cause an email to be sent
- subject Email subject
- from_name Email "from" name
- from_email Email "from" email address
- mailtype Use html or text
Example
This will list all affiliates and their link
{exp:affiliator:trigger total="10" order_id=""}
The content set between these tags will be used as the email message.
{/exp:affiliator:trigger}
Global Form Parameters
HTML parameters
id
CSS id of your form. This is an arbitrary value.
id="myform"
class
CSS class of your form. This is an arbitrary value.
class="my_form_class"
name
The name of your form. This is an arbitrary value.
name="my_form_name"
onsubmit
Optional javascript function to run once the form is submitted.
onsubmit="your_custom_javascript()"
variable_prefix
Allows you to add a prefix to all variables within the tag to avoid variable collisions with another tag.
variable_prefix="my_var"
This is an example of how you could then call the entry_id variable within the tag.
my_var_entry_id
Form submission parameters
secure_action
If set to "yes" the form will be submitted via https://
secure_action="yes"
return
This is the URL you'd like the site redirected to when the operation is complete. If left blank, the page will not redirect.
return="cart/view_cart"
secure_return
If set to "yes" the form will redirect to the https:// version of your return url after form submission.
secure_return="yes"
Troubleshooting
- If commissions are not being set when you make a test transaction, make sure you don't have "Allow self referrals" set to "No". If you are logged in with the same member connected to your affiliate ID, the system will not track your commission, because you are self-referring.
PayPal MassPay Edition
Affiliator is available as the standard edition, and the MassPay edition. If you have many affiliates that you need to pay referral bonuses to on a regular basis, you should purchase the MassPay Edition of Affiliator. This version provides additional automation options for paying commissions to Affiliates. When MassPay edition is installed, you will see additional buttons that say "Pay open commissions with PayPal MassPay" in several of the backend settings. When you click this button, PayPal MassPay will be used to pay any outstanding commissions to all affiliates.
Affiliator (MassPay) can be installed over the top of standard Affiliator. All settings and databases are the same from one edition to the next. The MassPay version can also be replaced by the standard version if need be.
Before you can begin using MassPay, you must sign up for MassPay at PayPal. MassPay is not available in all areas.
Developers
Included with Affiliator is a plugin that can be used as a model to tie your app in with Affiliator. Basically what's needed is:
- Load in the Affiliator Extension Code
- Instantiate that extension
- Call the calculate_commission function of the extension to register a commission with your app.