Restricted Blocks

Documentation of the Restricted Blocks plugin for WordPress

Table of Contents

  1. Installation (Single Site)
  2. Installation (Multisite)
  3. Quick Start
  4. Restrictions Menu
  5. Options Menu
  6. Block Inspector
  7. Geolocation
  8. Credits
  9. FAQ

1) Installation (Single Site)

With this procedure, you will be able to install the Restricted Blocks plugin on your WordPress website.

  1. Visit the Plugins -> Add New menu
  2. Click on the Upload Plugin button and select the zip file you just downloaded
  3. Click on Install Now
  4. 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:

  1. Visit the Plugins -> Add New menu
  2. Click on the Upload Plugin button and select the zip file you just downloaded
  3. Click on Install Now
  4. Click on Network Activate

With this procedure, you will be able to perform a Single Site Activation in a WordPress Network environment:

  1. Visit the specific site of the WordPress Network where you want to install the plugin
  2. Visit the Plugins menu
  3. Click on the Activate button

3) Quick Start

This section will guide you in the creation of a block restricted with a password.

  1. Install the plugin with the procedure described in the Installation (Single Site) or Installation (Multisite) section.
  2. Visit the Restricted Blocks -> Restrictions menu
  3. Enter the Name and the Description of the restriction
  4. Select the Password in the Type field
  5. Open the Password section of the menu and enter a password
  6. Click the Add Restriction button to save your changes
  7. Visit a post, page, or custom post type
  8. Click on a block
  9. Select the restriction you just created with the selector available in the Restriction section of the block inspector
  10. 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:

  1. Visit the Restricted Blocks -> Restrictions menu
  2. Enter the Name and the Description of the restriction
  3. Select Fixed in the Type field
  4. Click the Add Restrictions button to save your changes

Password

To create a restriction of type Password proceed as follows:

  1. Visit the Restricted Blocks -> Restrictions menu
  2. Enter the Name and the Description of the restriction
  3. Select Password in the Type field
  4. Open the Password section of the menu
  5. Enter password in the Password field
  6. Click the Add Restrictions button to save your changes

Age

To create a restriction of type Age proceed as follows:

  1. Visit the Restricted Blocks -> Restrictions
  2. Enter the Name and the Description of the restriction
  3. Select Age in the Type field
  4. Open the Age section of the menu
  5. Enter the minimum age required to view the content in the Minimum Age field
  6. Click the Add Restrictions button to save your changes

Geolocation

To create a restriction of type Geolocation proceed as follows:

  1. Visit the Restricted Blocks -> Restrictions menu
  2. Enter the Name and the Description of the restriction
  3. Select Geolocation in the Type field
  4. Open the Geolocation section of the menu
  5. Click on the Locale selector and enter one or more countries
  6. 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:

  1. Visit the Restricted Blocks -> Restrictions menu
  2. Enter the Name and the Description of the restriction
  3. Select Device in the Type field
  4. Open the Device section of the menu
  5. With the Device control select whether to display the block with Desktop or Mobile devices
  6. Click the Add Restriction button to save your changes

Time Range

To create a restriction of type Time Range proceed as follows:

  1. Visit the Restricted Blocks -> Restrictions menu
  2. Enter the Name and the Description of the restriction
  3. Select Time Range in the Type field
  4. Open the Time Range section of the menu
  5. Enter the Start Date of the range
  6. Enter the End Date of the range
  7. Click the Add Restriction button to save your changes

Capability

To create a restriction of type Capability proceed as follows:

  1. Visit the Restricted Blocks -> Restrictions menu
  2. Enter the Name and the Description of the restriction
  3. Select Capability in the Type field
  4. Open the Capability section of the menu
  5. Enter one or more capabilities (one capability per line) in the Capabilities field
  6. Click the Add Restriction button to save your changes

IP Address

To create a restriction of type IP Address proceed as follows:

  1. Visit the Restricted Blocks -> Restriction menu
  2. Enter the Name and the Description of the restriction
  3. Select IP Address in the Type field
  4. Open the IP Address section of the menu
  5. Enter one or more capabilities (one capability per line) in the IP Address field
  6. Click the Add Restriction button to save your changes

To create a restriction of type Cookie proceed as follows:

  1. Visit the Restricted Blocks -> Restrictions menu
  2. Enter the Name and the Description of the restriction
  3. Select IP Address in the Type field
  4. Open the IP Address section of the menu
  5. Enter one or more capabilities (one capability per line) in the IP Address field
  6. Click the Add Restriction button to save your changes

HTTP Headers

To create a restriction of type HTTP Header proceed as follows:

  1. Visit the Restricted Blocks -> Restrictions menu
  2. Enter the Name and the Description of the restriction
  3. Select HTTP Header in the Type field
  4. Open the HTTP Header section of the menu
  5. Enter name of the HTTP header in the Header Name field
  6. Enter one or more HTTP header values (one value per line) in the HTTP Header Value field
  7. 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:

  1. Set the Options -> Geolocation -> Geolocation option to “Enabled”.
  2. Set the Options -> Geolocation -> Geolocation Service to “MaxMind GeoLite2”.
  3. Select the countries where the plugin should display the cookie notice with the Options -> Geolocation -> Geolocation Locale option.
  4. 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.
  5. 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:

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.