Restricting View Content to be Members-Only
Restricting your Views can be helpful if you run a membership site and you want to restrict content to registered users. There are a couple of different ways to protect your Views by login status or user role.
1. By Using a Membership Plugin
The WordPress Members plugin by MemberPress allows you to restrict access to content on your website. It’s effective, powerful, and best of all, free.
To get started, log in to your WordPress site, hover over Plugins in the left-hand menu and click on Add New. Next, search for “Members - Membership & User Role” and install the plugin.
[gravityview] embed shortcode in the
[members] shortcode to restrict access to logged-in users.
[members_logged_in] [gravityview id='47'] [/members_logged_in]
You can also restrict your view based on user role:
[members_access role="subscriber"] [gravityview id='47'] [/members_access]
2. By Password-Protecting Your Page
WordPress gives you the ability to password protect pages, posts, and Views.
To password protect your View (or a page where your View is embedded), click on the Edit link next to Visibility. Next, check “Password protected” and enter your chosen password.
You can also restrict access to your View by making it “Private”. If you select this option only Administrators and Editors will be able to see your View and its content.
3. By Hiding Certain Fields in Your View
GravityView gives you the ability to restrict access to certain fields based on login status or user role. This is a great option if you want some information in your View to be public and other information to be private.
To do this, edit your View and click the gear icon next to the field you want to restrict. This will bring up the Field Settings window. Under Visibility, check the box that says “Make visible only to logged-in users?”.
To restrict visibility to specific user roles, select a role from the dropdown menu below. The different options are:
- Any Logged-In User
- Author or Higher
- Can View gravity Forms Entries
- Editor or higher
- Can Edit Gravity Forms Entries
If you want to modify the visible roles, you can follow these instructions.
4. By Redirecting Logged-Out Users
Using the Redirection plugin you can redirect users based on login status or user role.
After activating the plugin, create a new redirect rule for your View page. Next, click on the gear icon to bring up additional options. Here you can configure redirects based on login status or user role.
For a full video course on using the Redirection plugin to protect Views in GravityView, check out our free course on Gravity Guide.