[email protected]
WordPress Development
  • Home
  • Blog
  • Pricing
  • Urbex
  • FAQ
    • Guest Blogging
    • Cookie Policy
    • Privacy Policy
  • Contact
  • Codeable
  • Recommended WordPress Hosting
    • Kinsta
    • Cloudways
    • WordPress.com
    • Bluehost
Select Page

Gravity Forms Create Front End Login / Register / Edit account – PART 2

by Rafał Gicgier | Oct 7, 2014 | Gravity Forms, Gravity Series Login, Plugin Development | 0 comments

Welcome to the second part of the Gravity Forms Front End Login / Register / Edit account series.
In our previous tutorial we have created a simple Gravity based login form. In this tutorial we’ll cover the user registration form.

Part 2 – creating a simple register page

Similarly to the previous form let’s go ahead and create a form with two simple fields:

  1. Username (with the username CSS class assigned)
  2. Email (with the email CSS class assigned)

Following the pattern, we’ll need to setup two hooks:

  1. Which fires during the form validation
  2. Which fires during the form submission

Gform pre submission hook

This hook fires before the form has been submitted, but after the values have been validated.

Let’s see the code we’ve used for that part:

This hook will do the following:

  1. Sanitize and store the $_POST superglobal array submitted form fields in the corresponding variables
  2. Verify if the username and email exist
  3. If not – create a new user and notify him via email with his automatically generated password

Gform validation hook

Now, we can already register a new user, however the validation rules will not show up if we won’t create them! This means that the form can be submitted even if the specified data would conflict with the existing entries.

The following code will assure us that the form is validated properly:

The above hook is triggered separately for each of the form fields – this is why we need to rely on CSS class names, which we had created before.

This finishes the second part of our tutorial. The user registration is disabled for our site, hence we won’t be posting a working form this time!

Categories

Sponsored Content

The Ultimate Managed Hosting Platform



WooCommerce

COPYRIGHT

Copyright © 2022 WP doin – Rafał Gicgier

INVOICING:
WP DOIN – RAFAŁ GICGIER
Łódź, ul.Henryka Sienkiewicza,
nr 85/87, lok. XI, 8, 90-057
PL7251927749
[email protected]

Recommended ENTERPRISE Hosting

By browsing through the site and filling in the Contact Forms you agree to our PRIVACY POLICY.
Moreover WP doin website uses COOKIES to improve your experience. We assume you're ok with this, but you can opt-out if you wish.
ACCEPT REJECT
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT