WordPress Automations
Add a Role to a User When They Click a Button
Sometimes access should be a one-click choice: "Join the beta", "Become a subscriber", "Unlock the member area". Zapify handles that with the A user clicks a button trigger and the Add a role to a user action. Both are free.
For how buttons and keys work in detail, see Buttons.
What this automation does
The automation is one trigger plus one action:
- Trigger: A user clicks a button (
BUTTON_CLICKED, Buttons) - Action: Add a role to a user (
WP_ADD_USER_ROLE, WordPress)
When a logged-in visitor clicks the button that matches the trigger's key, Zapify grants them the role you choose.
Before you start
- The role you want to grant must already exist.
- Only logged-in visitors can click a button; logged-out visitors see Log in to do this.
- Both the trigger and the action are free.
Choose the role carefully
Anyone who can see the button can grant themselves this role. Use it for low-privilege roles like a "beta tester" or "member" role — never for anything with administrative rights.
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 Join the beta.

Step 2: Add the "A user clicks a button" trigger
- Click Add Trigger.

- Choose Buttons as the app.

- Select A user clicks a button.
- In Button key, type a name of your choice, for example
join-beta.
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.

- Pick the Role, and leave User empty so it applies to whoever clicked.

Step 4: Set the steps Live and save
- Set both the trigger and the action to Live.
- Click Save.

Step 5: Place the button on a page
Add this shortcode to any page, post or widget, using the same key:
[zapify_button key="join-beta" label="Join the beta"]
Tokens you can use
| Token | What it holds |
|---|---|
| Who clicked | The user's ID. |
| Their email address | The clicker's email. |
| Their username | The clicker's username. |
| Their display name | The clicker's display name. |
| Page it was clicked from | The URL of the page holding the button. |
How to test it
- Log in as a test user and open the page with the button.
- Click it and check the user's roles in Users.
- If nothing changes, open Zapify → Logs, and confirm the shortcode's
keymatches the trigger's key exactly.
Conclusion
With the A user clicks a button trigger and the Add a role to a user action, Zapify turns a single click into access. Next, read the full guide to Buttons, or add a confirmation with send a welcome email.
FAQs
Can someone click the button twice?
The automation runs once per user by default, so repeat clicks don't repeat the action.
Is this feature free?
Yes. Both the trigger and the action are free.
Do I need to write any code?
No — you only paste a shortcode onto the page.