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:
- Restrict full content - Restrict all content on the page.
- Restrict partially content - Showing some percentage of the content with a fade effect and message (configurable in the labels section). The percentage is defined lower in the option Restrict partially content percentage.
- 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.
- Restrict partially content percentage - Set the percentage of how much content should be displayed when the option Restrict partially content is enabled. Default value is 20%. Note: this option was introduced in version 1.6.0.
- Enable restriction with custom filter - Enable this option if you want to restrict access with custom filter called cmsar_single_content in your theme. Example: apply_filters('cmsar_single_content', $content);
Note: this option was introduced in version 1.5.6.
- Maintain content format - This setting can be used with restrict partially content only.
- Exclude homepage displays with your latest posts - If you use the latest posts as the homepage, you can make the homepage an exception. Learn more: How To - Exclude Homepage When It Shows Latest Blog Posts
- Display restriction label on 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.
- Hide admin bar - If enabled, the admin toolbar will be hidden for all users on the front-end. Note: this option was introduced in version 1.6.5.
- Allow admin bar for specific roles - Choose user roles which are allowed to see the admin toolbar, in case if you enabled the option Hide admin bar. Note: this option was introduced in version 1.6.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"]
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.
- Access denied X days from user first access - Set the number of days of access expiration. After passing this amount of days the user loses his access to the content after first accessing it. This option was introduced in version 1.5.8.
- 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 restricted by specific date/time - Access is allowed only within defined period of time. You need to set start and end dates in the fields From and To. This options was introduced in version 1.5.8.
- Access denied X days from registration - Access is restricted for users that registered less than X days ago.
- Restriction message view - This option overrides global settings. 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 - Works the same as in global settings.
- Restrict partially content - Works the same as in global settings.
- Restrict content with shortcode only - Works the same as an option in global plugin settings. This feature was introduced in version 1.5.5.
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: