Ever wanted to create a simple Gravity Forms user login page without the need of investing into add-ons?
This tutorial will move you through the process of a solid Front End process.
Part 1 – creating a simple login page
First let’s go ahead and set up a simple form with two fields.
- Username (please assign username class to the field)
- Password (please assign password class to the field and make sure the password checkbox is checked)
Once set up with the two embed the form anywhere in the page likewise:
Now, let’s setup two hooks, that will login the user:
- Runs once the form is submitted
- Runs during the form validation
1. Gform after submission hook
This hook fires after the form was submitted and the whole data was validate, we’ll bind it to the form which have just created.
2. Gform field validation hook
This hook fires during the form submission process and iterates over every field.
Once these two were set up (placed anywhere in the functions.php file) we can go ahead and test the form embeded to a page. Let’s do some testing:
I tried logging in with the wrong password and I failed! This means that the validation is working properly. Let’s go ahead and login with the real credentials – boom I tested it and logged in successfully.
Latest posts by Rafał Gicgier (see all)
- OptiPic.io – How and why to optimize the image on the site? - 8 April 2019
- Guest post at WP doin! - 26 March 2019
- A Gutenberg WordPress 5.0 plugin review. Is it worth it? - 8 December 2018