Affiliate program setup with uc_affiliate2

Last updated on
4 October 2017

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

This document will discuss the setup of an affiliate program, like the one at book.drupalfun.com. Feel free to take a test-run through the affiliate sign up process at http://book.drupalfun.com/affiliate. I will be describing how I made this particular setup.

1. Enable the necessary modules

In order to set up an affiliate program, we need to enable the following modules at /admin/build/modules:

2. Configure Affiliate2

The first thing to configure, is the affiliate2 module at /admin/store/affiliate/settings

This page is documented pretty good and allows you to specify your affiliate depth and commission structure. An important option to look at is the “subdomain handling” checkbox. Generally, it's a good idea to leave this unchecked, unless you know what you are doing.

The Affiliate2 module uses “roles” to specify whether a user is an affiliate or not. So the first thing for us to do is to create a new role called “affiliate” at /admin/user/roles. Give this role the permission to “act as an affiliate” at (user management → access control or permissions).

3.a Letting your users apply to be an affiliate

The next step is to let your users apply for the affiliate role. This way you have total control over who does and does not fill your requirements (If you want to skip this and automatically approve affiliate applications, use the Role Signup module).

Let's configure the Apply for Role module at /admin/settings/apply_for_role, to allow single role applications for the affiliate role. Whenever a user applies for a role, you can check this at /admin/user/apply_for_role and we'll configure the system so that it sends you an email notification (in the next section).

3.b Automatically setting all users as an affiliate

In Permissions give the permission "act as affiliate" to the "authenticated user" role.

D6: /admin/user/permissions
D7: /admin/people/permissions

4. Collecting affiliate information

You most probably want to collect some information about your affiliates, like their PayPal address (you do want to pay them right?) and their website. We can add these fields at /admin/user/profile

Now, your users will be able to fill in this affiliate information under their account.

5.Setting up some important notifications

Although the system is operational at this time. It's important to set up some system messages, as to keep your users informed about their registration progress.

a. Registration welcome email

If you did not enable the “apply at registration” option above, you need to inform your users that if they want to become an affiliate, they still need to click the “apply for role” button after logging in. You can do this in the default welcome email at /admin/user/settings.

b. Screen message thanking for role application

Create a “display a message to user” action at /admin/settings/actions.

Set up a trigger at /admin/build/trigger/apply_for_role. Select the action you have just created for the trigger: “When a user submits an application for a role”. This will display a message on the screen, informing the user about his pending application.

c. Email admin about the application

Unless you plan on logging in constantly, and checking the affiliate applications manually at /admin/user/apply_for_role, you probably want to be emailed whenever a user applies for the affiliate program. This is done in a similar fashion as the above message:

- Create a “send e-mail” action at /admin/settings/actions.

Set up a trigger at /admin/build/trigger/apply_for_role. Select the action you have just created for the trigger: “When a user submits an application for a role”. This will send an email to the admin about the new affiliate application.

d. Email the user about the approval

Lastly, we need to inform the user that his affiliate-ship has been approved. We'll send an email with this information, plus some details on where they can find their personal links etc.

We need the Role Change Notify module for this. After enabling the module, go to /admin/user/role_change_notify, and set up the email for the role “affiliate”.

6. Informing users about the program

Your affiliate program is up and running smoothly. The one thing left to do, is to write a small document (create a page) informing your users about the program and how to apply:

7. Bonus: Contacting all your affiliates

In order to send an email to all your affiliates, you can use the Mass Contact module to contact all of the users that have the “affiliate” role. Set up a category for this at /admin/build/mass_contact/

Try a live demo here

Help improve this page

Page status: No known problems

You can: