Anonymous recipes, introduced in Uncanny Automator Pro 2.0, can be triggered by anyone, including both logged-in and anonymous users. Unlike Logged-in recipes, they enable a recipe to create new users on your site, or perform actions on a user that’s different than the one that triggered the recipe. They also enable WordPress to accept incoming webhooks and use that data to create or modify users. A new recipe component called the User Selector is what makes all of this possible.
Introducing the User Selector
The User Selector available in Anonymous recipes is what connects the trigger to actions on a specific user. It provides two possible functions:
- Creating a new user
- Selecting an existing user
Once the user selector has created or selected a user, the recipe’s actions then are performed on that user.
The user selector opens up some powerful workflow possibilities, such as:
- Taking a regular form (using any supported form integration including [list with links]) and converting it into a form that register a new user, then performs any number of actions on that user such as enrolling them in a LearnDash course, adding them to a BuddyPress group, emailing them a coupon code, etc.
- Receiving data via a webhook from a service like Zapier, IFTTT, Integromat, or another site running Uncanny Automator that creates a new user or modifies an existing user.
Creating a new user
Select this option if you want completion of the recipe’s trigger to create a new user on which the recipe’s actions will be performed. You’ll see a form containing the standard WordPress profile fields:
Use the token selector to populate the fields with data from the recipe’s trigger.
If you don’t see any tokens, configure a trigger that will provide data for the new user, then come back to this field and select a token.
Note: If you don’t populate the Password field, a random password will be stored and the user will need to reset their password to access the site. Use the Send an email action and include the Reset Password Link token to make this process seamless and secure.
Once you’ve added data for the required fields and any desired optional fields, choose whether or not to automatically log the new user in.
Then decide what should happen if the user already exists. The two options are:
- Select existing user – Perform the recipe’s actions on the existing user.
- Do nothing – The recipe terminates and no actions are performed.
Select existing user provides an additional field that allows you to prioritize which user should be selected if two different existing users are found, one that matches the specified email and a different user that matches the specified username. Typically, this is a very rare case.
Select an existing user
Select this option if you want completion of the recipe’s trigger to select an existing user on which the recipe’s actions will be performed. You’ll see a form that lets you choose which unique field should be used to select an existing user; username or email:
Use the token selector to populate the field with data from the recipe’s trigger. If you don’t see any tokens, configure a trigger that will provide data to select an existing user, then come back to this field and select a token:
Once a new user has been created or an existing user selected, the recipe executes the actions on the selected user, just like a Logged-in recipe. Learn more about Managing Actions.
With great power comes great responsibility
Anonymous recipes are very powerful and enable automation of user creation and modification by anyone, without authentication. Always think about who can access the Anonymous trigger (if it’s tied to submission of a form) and how it could be potentially misused to create or modify users on your site. Questions to ask when setting up an anonymous trigger include:
- Should anyone be able to access this form, or should only some users be allowed to perform the actions of the recipe, including creation or modification of users?
- Should the form be indexable by search engines?
- Should the page containing the form show up in the results when a user uses the search field on your website?
If you’ve set up several forms that perform different actions, consider restricting access to the forms using your membership plugin or any other plugin that limits access to pages based on your desired criteria.