This post will show you how to require additional user information besides a password, e.g. email or username, to unlock partial content protection.
You need to use Advanced Custom Fields (ACF) plugin to create additional fields in the password form.
- Create additional fields using ACF
- Protect content sections
- Track additional information
- Logic & Limitations
- Password Protect WordPress Lite version 1.7.5 or greater
- Password Protect WordPress Pro version 1.2.2 or greater
- PPWP Password Suite version 1.3.6 or greater
- Advanced Custom Fields version 5.9.0 or greater
- PPWP Statistics version 1.3.4 or greater
Create additional fields using ACF
After activating ACF plugin, navigate to the Custom Fields menu and create a new field group.
Let’s say you want users to input their names and emails when unlocking the password protected sections, simply create three fields as shown below.
There are some notes on creating a field and field group.
- Field Label will be shown in both password form and Statistics table.
- Only fields with supported field types (listed below) will be displayed in the password form.
- Enable “Required?” option to prevent users from leaving the additional field empty.
- Add some instructions for users using Instructions, Prepend, Append (appear above the input), or Placeholder Text (appear within the input).
- The options, including Default Value, Conditional Logic, Location, Settings are not required.
- Since you show these fields the frontend rather than editor pages, it’s better if you change the field location to somewhere you don’t use in the backend, such as trashed pages. Otherwise, you might not be able to publish the content until you fill the required additional fields.
Once you add these fields to partial content protection (PCP) form, the fields will show as below.
Protect content sections
You will protect a content section using [ppwp] shortcode as normal. In order to display the additional fields built by ACF plugin in the PCP form, simply add the
acf_field attribute to the shortcode as below.
[ppwp pwd_label="password_label" acf_field="field_group_key"] Your protected content [/ppwp]
You can find the field group’s key in Custom Fields >> Field Groups dashboard.
It’s important to know that if you want to track user information, you need to use global shortcode (PCP) passwords, not inline ones.
Track 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.
Then switch to the “PCP Password Usage” table and select to display information based on “ACF Group”.
You need to click on the “plus” icon (+) to see the detailed information.
If users log into your site, their username will be shown under the “Username” column. Otherwise, N/A will display.
Logic & Limitations
- The quick access links (QALs) will bypass this function by default. In other words, if users access your protected content sections via QALs, they will provide neither additional information nor a password. As a result, the related data in Statistics will be empty.
- If you find that the additional fields don’t appear, it might be due to one of the following reasons:
- You haven’t activated or updated plugins to the required versions.
- The field group’s key is not correct.
- The file type is unsupported.
- Exporting additional information is not supported at the moment.
- When a field is deleted or moved to another group, the data will be kept but the column name will be changed to file_ID.