Do you want users to verify email addresses before submitting a WordPress form? Do you want email verification without user registration?
Approximate read-time: 5 minutes
Sometimes you just don't want to invite everyone to the party. Requiring email verification to unlock access to forms is one way to ensure only verified users can see a form.
This isn't something you'd do to all your contact forms, but if you want users to register for an invite-only event, you'd need to make sure that only the invited users can access your registration form.
In many cases, it is essential to ensure form submissions come from legitimate users.
Email verification can be triggered automatically when a new user is registered on your WordPress site. If you create user accounts with your WordPress forms, you can block other forms from logged-out users. Quick and simple.
In this quick guide, we'll show you how you can ensure only valid form entries by verifying email addresses in WordPress. Once the setup is complete, you'll have a WordPress form that can only be completed after an email address has been verified. Let's dive in!
👉 Read more: 7 Best WordPress Email Marketing Plugins
Verify email address without registration
Although this isn't a built-in feature in Formidable Forms, our WordPress form builder is quite dynamic. With a few tweaks, you'll be able to verify user email addresses in any WordPress form you choose!
If you haven't settled on a complete WordPress form building solution for your WordPress site, now is the time! We offer a 14-day money-back guarantee. In theory, you could try out Formidable, follow this guide, and get your money back immediately if you don't like the results.
...no questions asked!
Here are the basic steps we'll take in this how-to guide:
- Create the email verification form
- Use a View to hide form B (unless email is verified)
- Add a verification link in the email message
Step 1: Create the email verification form
First, create a form to request the user's email address. This form can be short and sweet, without extra details. My form asks for an email address with a confirmation field. That's it.
This initial form displays a success message to instruct the user to check their inbox and confirm the email address.
Step 2: Use a View to hide form B (unless the email is verified)
Form B should only be visible to users who have verified their email address via Form A. To achieve this, place the shortcode for form B inside a View. Use filtering to hide it from non-verified users.
- Set the View to show a "Single Entry" from Form A.
- I'll keep it simple, with only the shortcode for Form B in the Content box.
- Add two filters so the View Content (Form B) will only be visible if both the Entry Key and Email Address match an entry in Form A. Add default=1 to the filters so if the url is tampered with, that filter will not be ignored.
If the page is loaded directly without clicking on the link in the email, these filters will return "No Entries" and hide the form. The security of this system is greatly increased by combining the random (and not publicly visible) entry key with the email address.
Modify the default "No Entries" message to include the shortcode for Form A or a link to it. This tells visitors who may arrive at the page directly, that they must confirm their email address before proceeding.
Step 3: Add a verification link in the email message
When an email address is submitted in Form A, the verification email is triggered. The email message needs to contain a link to the View created in step 2.
I'm going to create this link using the guide to create a custom search. Pass both the entry key and email address to match the filters included in the View. You can use any form values you'd like as long as you add matching filters in the View.
When the link in the verification email is clicked, the View matches the data in the URL to an entry in Form A. When it finds a match, the form is visible!
So that's it! Three simple steps to create a form that can only be completed after email verification. Have you used similar methods to verify users who aren't logged in? Let us know in the comments below.
For more WordPress tips, guides, and how-to's, keep it locked to the Formidable blog. See you next time!