In order to let users register with Gravity Forms you must install the Gravity Forms User Registration Add-On.
If you want to add custom fields to user (and save them) you can use ACF plugin.
Step 1. Creating a User Registration compatible Gravity Form
The only required fields a Gravity form must contain to be compatible with the User Registration Add-On are the Username and Email fields. With that said, here are the steps used to create an optimal User Registration form.
- Username (required)
Add a Single Line Text field (under Standard Fields); used to map the Username for user registration. - First Name & Last Name
Add a Name field (under Advanced Fields). This will be used to map both the first and last name for user registration. - Email (required)
Add an Email field (under Advanced Fields); used to map the Email Address for user registration. - Password
Add a Password field (under Advanced Fields). This field will only be available after the User Registration Add-on is installed and activated. This field will be mapped to the Password field for user registration. - Additional Fields
You can add as many additional fields as you require. These fields can then be mapped to various User Meta fields available in the User Registration feed. For example, let’s add a number field that will store the user’s phone number.
Step 2. Setup a User Registration Feed
After you have installed the User Registration add-on for Gravity Forms, you’re ready to begin creating a feed. A feed is used to pass form submission information over to the add-on. Without it, the User Registration add-on won’t know how to handle the data.
To access feeds for the User Registration add-on, first access the form that you want to use with user registration. At the top of the page, you will see an option labeled Form Settings. Simply hover over it and click on User Registration.
Here, you will see any feeds available within the User Registration add-on. You likely won’t have any available here if you have not previously used this add-on. Simply click the Add New button at the top of the page to begin creating a new feed.
In the next page, name your feed and select the Create User field.
Step 3. Create a user registration page
Go to WordPress admin and create a new page. Let’s name it User Registration. In the editor, add the form from step 1 using the Gravity Forms shortcode.
Step 4. Create a user edit profile form
Duplicate the registration form from step 1. Since WordPress does not users change their username, edit form and remove the username field.
Step 5. Setup a User Edit profile Feed
Create a new feed (see step 2) but this time select the Update user field.
Step 6. Create a user edit profile page
Go to WordPress admin and create a new page. Let’s name it Profile page. In the editor, add the form from step 4 using the Gravity Forms shortcode.
Step 7. Let editor or shop manager approve users
Download the Gravity Forms Editor Access plugin from git.
If you want shop managers to edit forms, change editor to shop_manager in the code.
Customizing Gravity Forms User Registration Activation Page
Find the activate.php file in the GF User Registration plugin folder and place a copy of this file in your theme folder.
Path to GF User Registration activate.php file:
<root>/wp-content/plugins/gravityformsuserregistration/includes/activate.php
Sample path to your theme folder:
<root>/wp-content/themes/<your_theme>/
Add this code to your theme’s functions.php file:
/** * Gravity Forms Custom Activation Template */ add_action('wp', 'custom_maybe_activate_user', 9); function custom_maybe_activate_user() { $template_path = STYLESHEETPATH . '/activate.php'; $is_activate_page = isset( $_GET['page'] ) && $_GET['page'] == 'gf_activation'; if( ! file_exists( $template_path ) || ! $is_activate_page ) return; require_once( $template_path ); exit(); }
My pending actions list is empty
If your pending activation lists are empty then go to wp-config.php and change this line:
define('DB_CHARSET', '');