In a recent customization task, a user asked:
Create PHP code for a simple client portal that uses a unique password to redirect a client to a single password protected page. For example:
password1 ---> client1 password protected page
password2 ---> client2 password protected page
password3 ---> client3 password protected pageThis would be placed at the bottom of the page indicated above. No client interaction would be required. It would be great if the client only had to enter their password once at the portal and not again at the password protected
page .Additional passwords and client pages would be added by the website administrator (i.e. me). This could either be done by modifying the PHP code or with shortcodes on the password protected page. Whatever is easiest for you is fine with me.
In this members-only tutorial, I show how the above can be done without writing code, using Gravity Forms and another plugin.
First, let's see how the flow works.
Visitors see a form in which they can enter a password provided to them directly by the site owner (no user registration/usernames involved in this).
When a wrong password is entered we show a simple text message saying, "You've entered an incorrect password. Please try again."
When a valid password is entered, the user gets taken to a corresponding password protected page.
Ex.: Let's say pwd1 is entered and the admin has set up a redirect URL for it in the Gravity Forms form, the user gets redirected to that URL, for example, https://genesis28.test/page-1/
and when the form has been submitted with pwd2, the user gets taken to https://genesis28.test/page-2/.
Both Page 1 and Page 2 in this example are password-protected Pages and their corresponding passwords are pwd1 and pwd2 respectively.
The visitor need not enter the password a second time on the password-protected Page and everything works seamlessly.
Step 1
Create your desired password-protected Pages using the functionality built into WordPress.
Step 2
Install and activate Gravity Forms.
Create a new Form titled say, "User Redirection".
Add a single line text field named say, "Portal Password".
Set the field as Required.
In the Advanced tab, tick "Enable Password Input".
To view the full content, please sign up for the membership.
Already a member? Log in below or here.