How to Track Additional Information for Unlocking Password Protected WordPress 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.

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.
  • 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;
}
  • 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=1860) 
 */

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)
{
	return 1860 === $post_id;
}

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.

It is important to remember that the quick access link will bypass this function. 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.

Lasted updated on September 3, 2020