How to Track Additional Information for Individual Password Protected Content

In this article, we will show you how to require users to provide additional information, such as their emails or usernames, in order to unlock the protected content.

Requirements:

Add additional fields to password form

After activating our plugins, navigate to Password Protect WordPress >> Additional Fields tab from your admin dashboard and enable the corresponding option.

Once saved, a new field named “Email” will be added to the password form as shown below.

At the moment, additional fields are applicable only to single password form and not partial and sitewide ones.

You can edit the default input label as well as adding a new input field.

The Field Name will display under the Statistics table while the Input Label will be shown under the password form.

The Field Name will display under the Statistics table
The Input Label will be shown under the password form

It’s worth noting that:

  • Once a new field is added, it cannot be removed. Instead, you can choose to hide it using the “eye” icon action. That way, the collected data still shows in the Statistics table.
  • The style of additional fields will follow the style of the password field, which is customized easily via WordPress Customizer.

Increase the maximum number of additional fields

You’re allowed to generate up to 10 additional fields. To change this maximum value, simply add the following code snippet into your (child) theme’s functions.php file.

/** 
 * Increase the maximum number of new fields that can be generated to 20 
 */
add_filter('ppwp_ps_maximum_field', 'ppwp_ps_maximum_field');
function ppwp_ps_maximum_field()
{
	return 20;
}

Show additional fields on certain pages only

If you want to display additional fields in some particular password protected content only, add the following code snippet into your (child) theme’s functions.php file.

/** 
 * Show additional fields in specific posts only (e.g. post_id=37,60) 
 */

add_filter('ppwp_ps_is_show_additional_field', 'ppwp_ps_is_show_additional_field', 10, 2);
function ppwp_ps_is_show_additional_field($show, $post_id)
{
        $posts = [37, 60]; // define your post_ids here
        return in_array( $post_id, $posts );
}

Get the post ID by hovering over the desired post title.

Track users’ additional information

As long as PPWP Statistics is active, the additional information will be tracked.

To see the recorded data, navigate to Password Protect WordPress >> Statistics from your admin dashboard.

Click on “View Detail” to check who has used a certain password to unlock your protected content.

If users logged into your site, their username is shown under WP Username.

Require additional fields with access links

The quick access link will bypass this function by default. In other words, if users access your content via a quick access link, they will provide neither email/username nor password. As a result, the additional info will be empty.

In order to track information data without requiring users to enter a password, please enable “Require additional fields with quick access links” option and give them access via a quick access link.

Click here to see it in action.

Lasted updated on September 6, 2021