Site Access Restriction (SAR) - Plugin Settings
Plugin Settings Overview
This plugin allows users to create a membership and content restriction solution. The content restriction is based on user WordPress roles and whether or not they are logged in.
Setting up Access Restriction Pages
The first thing to set up after installation are the pages that users will be redirected to when trying to access restricted content. There are two types of access restriction. First, when the user is not logged in. Second, when the user is logged in but trying to access a page which is restricted for their role.
1) Accessing the Settings
Go to Admin Panel > CM Site Access Restriction Pro > Settings to open the settings page.
2) Go to the General Tab
In the General settings, you can specify both URLs.
The parameter ?cmreg_redirect_url= will work only with CM Registration Pro plugin (as shown below). To use the default WP login, apply ?redirect_to=
- The access defined URL is the general one which will also show for logged in users if they try to access content restricted for their WP role.
- The second URL (Login page URL) is the URL of the page which non logged in users will be redirected to when trying to access a page which has access restriction.
You can select the page where the user will be redirected after they try to visit a restricted page outside of an approved time. Approved time is defined on the next tab of the Settings - Post Types, in the field Access denied X days from registration.
Also, you can restrict dashboard access to certain roles. This feature was introduced in version 1.3.3.
How Much Content is Restricted
Choose how much of the content is restricted:
- Restricting the full content - Restrict all content on the page.
- Restrict partially content - Showing 20% of the content with a fade effect and message (configurable in the labels section)
- Restrict content with shortcode only - Show all content except those parts that are restricted by the [access] shortcode. Learn more about this shortcode. Note: this feature was introduced in version 1.5.5.
Let's restrict two different parts of the content with a shortcode that displays the message for non logged-in users:
[access login="1" deniedtext="This content is restricted"]
Creating Exception for Homepage
If you use the latest posts as the homepage, you can make the homepage an exception.
Display "Restricted Label" On The Archive Page
Archive pages are those that list items, such as your blog posts. To identify restricted posts, select Yes.
You can translate the message from the labels settings.
3) Go to the Post Types tab
Next is the Post types tab.
In this section you can restrict all posts which belong to a custom post type, as well as restrict access to the general pages and posts.
Here are the items you can restrict:
- Navigation Menu Items
- Custom CSS
- oEmbed Responses
- User Requests
- Reusable Blocks
- Theme Builders
- Header Layouts
- Body Layouts
- Footer Layouts
The available options for each item are:
- Access not restricted - Access is allowed to all roles including non authorized users.
- Access restricted to logged-in users - This means that all roles are authorized.
- Allow only anonymous access - Only non-authorized users are allowed to view the content. This option was introduced in version 1.4.10.
- Access restricted by role - Once selected you can specify which roles can access content.
- Access restricted by whitelist - Only users from the whitelist are allowed to view the content. This option was introduced in version 1.4.10.
- Access restricted by blacklist - Access is restricted only for users from the blacklist. This option was introduced in version 1.4.10.
- Access denied X days from registration - Access is restricted for users that registered less than X days ago.
- Restriction message view - Choose the view of the message that the user will see when he tries to get access to restricted page:
- Global settings - This is a default value. You can change it in the General tab of Settings.
- Restrict full content - The user will not see any content - just an invitation to log-in.
- Restrict with excerpt and fade effect - The user will see only little part of the content and an invitation to log-in.
Access restricted by Whitelist/Blacklist
Since the version 1.4.11 you can add users to whitelist or blacklist by searching them in the special field and then just checking their boxes.
Note On Media Files
In the case of media files, the plugin will restrict access to the media's Permalink, but not to the File URL.
The File URL usually follows the structure https://www.yoursite.com/wp-content/uploads/file
The image below has both Permalink and File URL highlighted: