How to Create and Manage Shortcode Global Passwords

Requirements:

What is shortcode global passwords?

In the previous versions, our PPWP Pro allows you to password protect content sections using this shortcode.

[ppwp passwords="password1 password2"] Your content [/ppwp]

These passwords – within the “passwords” attribute are stored together with your content – not separately in the database, and so, can’t be tracked by our Statistics plugin. If you want to use the same passwords on another content block, you have to type them again as well. They’re usually referred to as shortcode “inline” passwords.

In order to track and manage shortcode passwords more efficiently, global passwords that can be used across the different posts and content blocks are necessary.

How to create shortcode global passwords

Go to our plugin’s settings page and switch to “PCP Passwords” tab. After that, click on “Add New” button.

It will bring up a popup where you can create a new password including these pieces of information:

  1. New Password: unique, no space, case-sensitive and limited to 100 characters
  2. Label: Allow to give some extra information for your password, e.g. what it is used for
  3. (Password) Type:
    • Global (default): anyone with the password can unlock the protected section
    • Roles: only specific user roles are able to use the password to access the restricted area
      • Let’s say you set a password with type Role (editor)
        • Only editors can use this password to view the private part.
        • Others, e.g. subscribers, will receive an error message when attempting to enter it into password form.
  4. Usage Limit: the maximum number of times a password is used.
    • Let’s assume that the usage limit of a password is set to 1. If a user enters that password to unlock the protected content section, others can’t use it anymore.
    • This feature proves useful to prevent users from sharing your passwords without permission.
  5. Password Expiry: Make your password auto-expire after a period of time. In other words, users won’t be able to use that password to access your private section after a given time.

How shortcode global passwords work

Once generated, your password will display under PCP Passwords tab corresponding with an ID.

Simply copy the password ID and add it to the [ppwp] shortcode with “pwd” attribute in your content.

[ppwp pwd="ID_1, ID_2"] Your content [/ppwp]

For example, you want to use the password “123” with id 18, your shortcode should be something like below:

[ppwp pwd="18"] Your content [/ppwp]

Please note that:

  • You can add as many passwords in one shortcode as you want and separate them by a comma (,)
  • This shortcode will work similarly to the “inline” shortcode
  • If you add these 2 attributes to one shortcode, the content will be unlocked when users enter either password.

Let’s say you use the following shortcode to protect a part of your content.

[ppwp passwords="password1" pwd="id_1"] Your content [/ppwp]

Your users can unlock this restricted area when entering “password1” as well as to use the password with the id_1.

How to manage shortcode global passwords

The PCP passwords feature also comes with an easy-to-use interface allowing you to create unlimited passwords and manage all of them in one place. You will have full control over your passwords, including (de)activating or deleting, as well as restricting passwords by usages, time, and user roles.

  • If a password is inactive or deleted, the private sections will be locked again with those who have used this password to access.
  • If a password expires, no one can use it to access your private sections anymore. However, the partially protected content will still visible to users who have already entered this password until its cookie expires.
Lasted updated on March 19, 2020