Table of Contents
- Installation (Single Site)
- Installation (Multisite)
- Quick Start
- Restrictions Menu
- Options Menu
- Block Inspector
- Geolocation
- Credits
- FAQ
1) Installation (Single Site)
With this procedure, you will be able to install the Restricted Blocks plugin on your WordPress website.
- Visit the Plugins -> Add New menu
- Click on the Upload Plugin button and select the zip file you just downloaded
- Click on Install Now
- Click on Activate Plugin
2) Installation (Multisite)
This plugin supports both a Network Activation (the plugin will be activated on all the sites of your WordPress Network) and a Single Site Activation in a WordPress Network environment (the plugin will be activated on a single site of the network).
With this procedure, you will be able to perform a Network Activation:
- Visit the Plugins -> Add New menu
- Click on the Upload Plugin button and select the zip file you just downloaded
- Click on Install Now
- Click on Network Activate
With this procedure, you will be able to perform a Single Site Activation in a WordPress Network environment:
- Visit the specific site of the WordPress Network where you want to install the plugin
- Visit the Plugins menu
- Click on the Activate button
3) Quick Start
This section will guide you in the creation of a block restricted with a password.
- Install the plugin with the procedure described in the Installation (Single Site) or Installation (Multisite) section.
- Visit the Restricted Blocks -> Restrictions menu
- Enter the Name and the Description of the restriction
- Select the Password in the Type field
- Open the Password section of the menu and enter a password
- Click the Add Restriction button to save your changes
- Visit a post, page, or custom post type
- Click on a block
- Select the restriction you just created with the selector available in the Restriction section of the block inspector
- Update the post
After completing this procedure the block content will be replaced with a form that require the submission of a password.
Please note that the are multiple types of restrictions applicable to a block, for more information visit the Restrictions Menu section.
4) Restrictions Menu
The Restrictions menu should be used to create restrictions. You can assign the restrictions created with this menu to any block available in your posts.
Fixed
To create a restriction of type Fixed proceed as follows:
- Visit the Restricted Blocks -> Restrictions menu
- Enter the Name and the Description of the restriction
- Select Fixed in the Type field
- Click the Add Restrictions button to save your changes
Password
To create a restriction of type Password proceed as follows:
- Visit the Restricted Blocks -> Restrictions menu
- Enter the Name and the Description of the restriction
- Select Password in the Type field
- Open the Password section of the menu
- Enter password in the Password field
- Click the Add Restrictions button to save your changes
Age
To create a restriction of type Age proceed as follows:
- Visit the Restricted Blocks -> Restrictions
- Enter the Name and the Description of the restriction
- Select Age in the Type field
- Open the Age section of the menu
- Enter the minimum age required to view the content in the Minimum Age field
- Click the Add Restrictions button to save your changes
Geolocation
To create a restriction of type Geolocation proceed as follows:
- Visit the Restricted Blocks -> Restrictions menu
- Enter the Name and the Description of the restriction
- Select Geolocation in the Type field
- Open the Geolocation section of the menu
- Click on the Locale selector and enter one or more countries
- Click the Add Restrictions button to save your changes
Please note that, in order to be used, this restriction requires the configuration of a Geolocation service. For more information see the Geolocation section.
Device
To create a restriction of type Device proceed as follows:
- Visit the Restricted Blocks -> Restrictions menu
- Enter the Name and the Description of the restriction
- Select Device in the Type field
- Open the Device section of the menu
- With the Device control select whether to display the block with Desktop or Mobile devices
- Click the Add Restriction button to save your changes
Time Range
To create a restriction of type Time Range proceed as follows:
- Visit the Restricted Blocks -> Restrictions menu
- Enter the Name and the Description of the restriction
- Select Time Range in the Type field
- Open the Time Range section of the menu
- Enter the Start Date of the range
- Enter the End Date of the range
- Click the Add Restriction button to save your changes
Capability
To create a restriction of type Capability proceed as follows:
- Visit the Restricted Blocks -> Restrictions menu
- Enter the Name and the Description of the restriction
- Select Capability in the Type field
- Open the Capability section of the menu
- Enter one or more capabilities (one capability per line) in the Capabilities field
- Click the Add Restriction button to save your changes
IP Address
To create a restriction of type IP Address proceed as follows:
- Visit the Restricted Blocks -> Restriction menu
- Enter the Name and the Description of the restriction
- Select IP Address in the Type field
- Open the IP Address section of the menu
- Enter one or more capabilities (one capability per line) in the IP Address field
- Click the Add Restriction button to save your changes
Cookie
To create a restriction of type Cookie proceed as follows:
- Visit the Restricted Blocks -> Restrictions menu
- Enter the Name and the Description of the restriction
- Select IP Address in the Type field
- Open the IP Address section of the menu
- Enter one or more capabilities (one capability per line) in the IP Address field
- Click the Add Restriction button to save your changes
HTTP Headers
To create a restriction of type HTTP Header proceed as follows:
- Visit the Restricted Blocks -> Restrictions menu
- Enter the Name and the Description of the restriction
- Select HTTP Header in the Type field
- Open the HTTP Header section of the menu
- Enter name of the HTTP header in the Header Name field
- Enter one or more HTTP header values (one value per line) in the HTTP Header Value field
- Click the Add Restriction button to save your changes
5) Options Menu
The Options menu includes 21 options that you can use to customize the style of the front-end elements, the settings of the geolocation service, and other advanced options.
For more information about a single option, hover the mouse over the question mark on the right side of the option. The plugin will display a tooltip with additional information.
6) Geolocation
With the restriction of type Geolocation, you can display blocks based on the location of the user.
The position of the user is retrieved with the the MaxMind GeoLite2 database. Additional geolocation services may be supported in future plugin versions.
Please note that:
- The results provided by geolocation services are not 100% accurate.
- You have to follow the terms of service of the geolocation services.
Geolocation with MaxMind GeoLite2
Restricted Blocks supports the GeoLite2 IP geolocation database provided by MaxMind.
You can manually download the database and move it to the location specified with the Options -> Geolocation -> MaxMind Database File Path option or enter your license key in the Options -> Geolocation -> MaxMind License Key.
When you provide a valid license, the plugin automatically downloads the database (from the MaxMind website) every week with WP Cron.
To enable the geolocation with MaxMind GeoLite2, please proceed as follows:
- Set the Options -> Geolocation -> Geolocation option to “Enabled”.
- Set the Options -> Geolocation -> Geolocation Service to “MaxMind GeoLite2”.
- Select the countries where the plugin should display the cookie notice with the Options -> Geolocation -> Geolocation Locale option.
- Enter your MaxMind License Key in the MaxMind License Key field. To download the license key, log in to the MaxMind website and generate a license key in the Manager License Key tab.
- Enter the path where you want to store the database in the MaxMind Database File Path option.
7) Block Inspector
The plugin adds the Restriction control to the settings sidebar of all the blocks. Use this selector with one of the restrictions defined in the Restricted Blocks -> Restrictions menu.
8) Credits
This plugin makes use of the following resources:
- Select2 licensed under the MIT License
- Mobile Detect licensed under the MIT License
- Composer licensed under the MIT License
- GeoIP2 PHP API licensed under the Apache License 2.0
- MaxMind DB Reader PHP API licensed under the Apache License 2.0
- Common Code for MaxMind Web Service Clients licensed under the Apache License 2.0
Disclaimer
This product can include GeoLite2 data created by MaxMind, available from https://www.maxmind.com.
9) FAQ
Which versions of PHP are supported?
PHP 5.6 and later versions are supported.
Which versions of WordPress are supported?
WordPress 5.0 and later versions are supported.