223

Product support

Get help in the plugin support forum.

Categories

The plugin allows you to restrict access to certain sections of the site, and give users temporary access to these sections.

This can be useful when you want to sell access to certain sections of your site. Or you just want to temporarily show some sections only to certain users.

The plugin contains a component with which you can block access, and the plugin also extends the RainLab.Users backend by adding a field to set the date until which access will be granted.

Requirements

This plugin requires the RainLab.Users plugin must be installed.

Component properties

Plugin configuration

Make sure that guest access is closed on the page using the Session component of the RainLab.User plugin.

To close access to any CMS page, you just need to add the Timelock component. Then specify the page for the redirect. The user who is not authorized will be redirected to this page.

Setting access time

To set the access time, go to the user profile (plugin RainLab.User), and edit the "access until" field in the Timelock tab.

Setting access time programmatically

To set access times with PHP, use the lock_at attribute of the associated User model. Note that this attribute takes an Argon object.

$user = Auth::user();
$user->timelock->lock_at = Argon::now()->addMinutes(5);

Hiding part of the page

To hide part of the page, use the is_unlocked () method as follows

{% if (user.timelock.is_unlocked()) %}
    <h3 class="text-danger">Restricted Knowledge</h3>
{% endif %}
1.0.2

Created table xl1034_timelock_access

Feb 28, 2021

1.0.1

Initialize plugin.

Feb 28, 2021