Using Automation Component to create a new WordPress user account.
Inbound Now ships a WordPress plugin called Inbound Pro which offers a intense marketing automation component that can perform actions based on sitewide events using WordPress’s internal hooks and filters system.
One of the events we can listen to is fired when a new lead is created inside our leads plugin. This trigger event happens when an Inbound Form is submitted, or a 3rd party form like Gravity Forms or Ninja Forms, that’s connected to our plugin, is submitted.
In this guide I’ll show how to use our Automation component to:
- Create a new automation rule that targets new leads
- Create an action that creates a new WordPress User
- Assign a user role to created user
- Optionally log the user in automatically.
1. Create a new automation rule that targets new leads
Please note that our powerful automation component is a gated feature that we provide to active Inbound Now subscribers only. Also notice that in the rule below we have a section titled “Define Conditions”. In this section we use data sent over by our selected trigger to determine if we should continue processing the event.
2-4. Create an action that creates a new WordPress User, Adds a role, logs the user in
After setting up the conditions for our actions we can create the actions themselves. In this case we are:
- Creating a new user based on data included in the form submission
- Assigning the user to the ‘Seller’ userrole.
- Logging in the user immediately.
An additional feature of the ‘Create User’ action is that a password reset email is immediately generated and sent to the new user.
Within our Automation Component we provide the user the option to process the rule immediately or defer it to a processing queue. Since we’re login users in we need to process users immediately, otherwise the login cookies will not set correctly. We actually added the deferment control features to support automatic logins.