This article requires the GP Populate Anything perk.
Buy Gravity Perks to get this perk plus 46 other premium Gravity Forms plugins!
User Registration is one of the most powerful capabilities Gravity Forms offers, giving you total control over the user registration process. Paired with Auto Login and Better User Activation, new user on-boarding in WordPress is seamlessly elevated from a process to an experience.
Keeping that process free of obstacles is important. A common obstacle happens when a user forgets that you have an account on your site. They navigate to the user registration page, fill out all the required fields, and are shown an error message after submitting. It’s a frustrating process that has wasted their time.
Using Populate Anything, you can remove this obstacle by checking to see if they have already registered and displaying a login link when appropriate.
Getting Started
In this tutorial, we’re going to add a login link that appears if a user attempts to register on your site with an email that already exists. This article assumes you’ve already setup your User Registration feed.
Once you have GF Populate Anything installed, follow the steps below to build the form.
Steps
Step 1 – Add an Email Field
All user registrations in Gravity Forms require a valid email address. If your form doesn’t already contain an Email field, add one now.
Step 2 – Check If the User Has Already Registered
Next, add a Single Line Text field to the form and name it “Email Check”. In this field, we’ll use Populate Anything to check to see if the entered email has already been registered. To do this, set Populate Anything to register from User meta and filter the User Email to the name of the Email field you created in Step 1.
Set the Value Template for this field to Email. What this will do is if the user’s email is connected to an account, the field value will be set to the found email. If the email hasn’t been used, the value will be blank.
Since this field is solely going to be used to determine if the entered email already exists, I suggest marking its Visibility to Hidden. Your users don’t need to see it on the form.
Step 3 – Show a Login Link
With our email check in place, the next step is to add a login link when the email already exists. To do this, add an HTML field to the form. Insert your login link and accompanying text into the Content of that field.
Enable Conditional Logic on the field and set it to show the field if the value of the “Email Check” field is not blank. Remember, if the email doesn’t exist, the value is blank; if the email does exist, the value is the user’s email.
That’s It
With the Conditional Logic in place on the HTML field, your user registration form is ready to go. When a user enters their email, Populate Anything checks to see if it already exists. If it does, the login link displays.
Taking It Further
Hide Submit Button
Adding the login link doesn’t prevent the user from submitting the form. Gravity Forms User Registration will prevent the registration from happening by displaying a validation message that an account with that email already exists, but you can take it one step further by hiding the Submit button.
To do this, navigate to the form’s settings page, scroll down to Form Button, and enable Conditional Logic. Use the same logic from the HTML field, but set it to Hide the field if “Email Check” is not blank.
When a user enters an existing email, the Submit button is replaced with your login link.
Did this resource help you do something awesome with Gravity Forms?
Then you'll absolutely love Gravity Perks; a suite of 46+ essential add-ons for Gravity Forms with support you can count on.
I do trust all of the ideas you have presented for your post. They are really convincing and can certainly work. Still, the posts are very short for novices. May you please prolong them a little from subsequent time? Thank you for the post.
Hi,
Thanks for your comment. I’ll pass your feedback over to our supervisor for consideration.
Best,
Hello – is it possible to completely hide the fields until the email is verified? I have a number of fields below that I don’t want to show unless the email is not associated with an account. I followed the instructions above for hiding fields, but they still show until I enter the email address and prove I have an account. Is there a way to hide those before someone enters an email address?
Thanks
Hi Erik,
The conditional logic setup for this would require an additional condition. What you’ll do is to Show the fields, if the “Email” field isn’t blank and the “Email Check” field is blank. Also instead of setting the conditional logic on each field, you could place all those fields under a Section field and set up conditional logic on the section field instead.
I hope this helps.
Best,
Great – thank you