View Categories

How to restrict whole site for certain users?

You can restrict all the content of your site to a certain set of users with the help of the Content Restriction feature. Follow this guide to achieve this.

  • Go to User Registration > Extensions > All Modules.
  • Search for ‘Content Restriction‘.
  • Activate it.

Once you have activated the Content Restriction module, you will need to add a content restriction rule. This rule will have the condition in which the content needs to be restricted, and also the action that happens after the content is restricted.

Adding a New Rule: #

Click on the Add New button to add a new rule.

After clicking on Add New, you will see a window as shown below:

Give a name to the rule and choose whether you want to create an access rule or a restrict rule. Access rules provide access as per the condition you will set and the restrict rules will restrict the content. Then, click on Continue.

How do we define the conditions? #

After you click on Add New, you will see that you are in the Conditions & Logics Tab by default and a Main Logic Group Section appears by default inside the Conditions & Logics Tab. You have the option to Add Fields where you can choose from various fields and set values to them and Add Groups where you can add a group inside which you can again add different fields or sub-groups.

Adding Fields #

Click on the Add Field button and you will see a dropdown with a list of options where you can choose between various fields to set up a condition.

You can select those from the list that you feel are necessary. For the demonstration purpose, I have selected some of them to let you know the purpose.

To view the content following rules must be followed:
User Based:
1. Roles: Users must have any one of the selected roles.
2. User Registered Date: Users must be registered within the selected date range.
3. Period After Registration: You can set the number of days during or after which the user is given access to the content.
4. User State: You can define whether the logged in or logged out users are able to access the content.

User Asset Based:
1. Email Domain: Specify particular email domains so that users with the specified email domain can only view the restricted content. You can specify multiple email domains separating them with comma. Like, gmail.com, hotmail.com, wpeverest.com, etc.
2. Minimum Public Post Count: The content visiting user must have minimum specified posts on your site as public.

Others:
1. Capabilities: The content-visiting users must have all the listed capabilities to access the content.
2. User Registration Source: Users must be registered from any of the defined sources to visit the content.
3. UR Form Fields: This field lets you choose the form field from any of the available User Registration forms. You can set a conditional logic so that the restriction/access happens when the form field value matches the condition.

How do you select the whole site for restriction? #

After you have set up the rules to access the contents in the Conditions & Logics Tab, you will need to specify the contents to be restricted. To do so, click on the Target Contents Tab and then click on the Add Fields button inside the Target Contents Tab. You will see the following options.

For restricting the whole site, select ‘Whole Site’.

After this, the users that match the condition will be given access to the whole site and others will be restricted.

Restricting whole site for logged out users will also restrict them from viewing the login and registration forms which isn't convenient. If you restrict whole site for the logged out customers, you will then have to either render the login form shortcode or select 'Show Message' option for the Action section. While showing the message, you can add the registration and login form shortcodes so that the logged out users can either login or register to your site.

Powered by BetterDocs

Scroll to top