AffiliateWP Automations
How to Add a WordPress User Role When an Affiliate Is Approved in AffiliateWP
A user role is the simplest way to unlock affiliate-only content, such as a marketing resources page or a private support forum. To add a WordPress user role when an affiliate is approved in AffiliateWP, use Zapify's An affiliate's status changes trigger set to Active with the Add a role to a user action. AffiliateWP is a Zapify PRO integration.
What this automation does
The automation is one trigger plus one action:
- Trigger: An affiliate's status changes (
AFFWP_AFFILIATE_STATUS_CHANGED, AffiliateWP) - Action: Add a role to a user (
WP_ADD_USER_ROLE, WordPress)
When an affiliate becomes Active, Zapify adds the role you choose to their WordPress account, and your membership or content plugin does the rest.
PRO feature
AffiliateWP is a Zapify PRO integration, so this automation needs an active Zapify PRO licence.
No Connection needed for AffiliateWP
AffiliateWP runs on your own site, so there is no API key to paste for it and nothing to set up under Settings → Connections.
Before you start
- AffiliateWP installed and active.
How to build the automation
Step 1: Create a new automation
- In the WordPress admin, go to Zapify → Automations.
- Click Add New to open the builder.
- Name it clearly, such as Give approved affiliates a role.

Step 2: Add the "An affiliate's status changes" trigger
- Click Add Trigger.

- Choose AffiliateWP as the app.

- Select An affiliate's status changes.

- Configure the trigger:
| Field | Required | What it does |
|---|---|---|
| Previous status | Yes | Leave on Any status, or pick the status the affiliate had before, such as Pending. |
| New status | Yes | The status that should start the automation: Active, Inactive, Pending or Rejected. |
Set New status to Active. Leave Previous status on Any status.
Step 3: Add the "Add a role to a user" action
- Click Add Action.

- Choose WordPress as the app.

- Select Add a role to a user.

Step 4: Configure the action
| Field | Required | What it does |
|---|---|---|
| User | No | Leave empty to use the user this automation is running for. |
| Role | Yes | The role to give them. The list shows the roles that exist on your site. |
| Replace existing roles | No | Off by default, so the role is added and the user keeps any others. Turn it on to replace every role they have. |
Leave User empty. The automation runs for the affiliate, so the role goes to them. Choose your role, such as a custom Affiliate role, and leave Replace existing roles off so they keep their current ones.
Step 5: Set the steps Live and save
Each trigger and action has its own Live / Off / Draft switch. A new automation starts as a Draft and does nothing until its steps are Live.
- Set the trigger and every action to Live.
- Click Save.

Step 6: Test it
Approve a test affiliate, then open Users in WordPress and check their role. Zapify's Logs show the run too.
Tokens you can use
The trigger offers the affiliate's details, one extra token for the old status, plus the user tokens.
| Token | What it holds |
|---|---|
| Affiliate ID | The affiliate's numeric ID in AffiliateWP. |
| Affiliate status | Their status: active, inactive, pending or rejected. |
| Affiliate referral URL | Their personal referral link, ready to put in an email. |
| Affiliate payment email | The address they get paid at. |
| Affiliate rate / Affiliate rate type | Their commission rate and whether it is a percentage or a flat amount. |
| Affiliate earnings / Affiliate unpaid earnings | What they have earned in total, and what is still waiting to be paid. |
| Affiliate previous status | The status they had before the change. |
| User ID / Username / User email | The user the automation runs for: the affiliate, or the referred customer when Run for is set to the customer. |
| Display name / First name / Last name | Their name details. |
Conclusion
With the An affiliate's status changes trigger on Active and the Add a role to a user action, approval unlocks access with no manual step. To also welcome them, add an approval email.
FAQs
Is this free in Zapify?
The Add a role to a user action is free, but the AffiliateWP trigger is part of the AffiliateWP PRO integration and needs an active Zapify PRO licence.
What happens to the role if the affiliate is deactivated later?
Nothing automatically. Build a second automation on the Inactive status if you want to take access away.
Can I create a custom role for affiliates?
Yes. Create it with any role plugin and it appears in the Role list.
Do I need to write any code?
No. Everything is configured visually in the Zapify builder.