Formidable forms is without a doubt one of the MOST loved form builder in WordPress. They have many cool features and addons which are updated frequently to match users requirements globally.
What makes it more cool than other bunch of form builders out there is, their rich documentation for normal users and developers. Using their developer documentation, we can do many customizations to the forms we build in it.
In this article, we are going to see how to create a WordPress user registration form using formidable forms free version. YES, you heard it, we are going to add user registration feature in Formidable forms free version.
Part 1 : Install the plugin and create user registration form in it
- Go to wp-admin->Plugins->Add new
- Search for “Formidable Forms”
- From search results install the plugin as shown in following screenshot.
Once you install the plugin, please go create a new form. I have created a form with following fields.
- Username
- First name
- Last name
- Address
Refer following screenshot.
Part 2 : Registration form settings
Once you finish creating all the required fields in the registration form. You need to set following settings.
- Do not save entries for this form, because we are going to create users. from form entries. So, no point in saving them as entries.
- Load and save the form builder with ajax for better user experience. I say this is optional.
- Validate the form with javascript is again for better user experience.
Part 3 : Write hook to create users from form entries
Use following code to capture form entries and create WordPress users. we use frm_after_create_entry hook to manipulate the user responses from form.
Validate username and email before creating user
To validate a field value dynamically, we use frm_validate_field_entry hook from formidable.
Part 3 : Send password reset email to user
Remember we have called “send_password_reset_email_new_user” function while creating user. This function will send a welcome email to the new user with a link to set a password for their account. You would have noted that we didn’t handle password part while creating an user. We leave that to the user itself.
Extend this code
What we saw here is just a sample of what we can do with Formidable forms and its well documented hooks and filters. If you are a pro developer in WordPress, I recommend you to
- Add other required fields in the registration form
- Capture them in usermeta while creating user.
- You can even write more logic on deciding the user role based on certain fields in the form.
We recommend you to check official website of Formidable Forms
- Official website – https://formidableforms.com/
- Official user registration add-on – https://formidableforms.com/features/wordpress-user-registration/
- Formidable forms developer documentation – https://formidableforms.com/knowledgebase-category/advanced-for-developers/