Download the PHP package jorenvanhee/craft-template-guard without Composer
On this page you can find all versions of the php package jorenvanhee/craft-template-guard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jorenvanhee/craft-template-guard
More information about jorenvanhee/craft-template-guard
Files in jorenvanhee/craft-template-guard
Package craft-template-guard
Short Description Password protect any page or entry in Craft CMS.
License proprietary
Informations about the package craft-template-guard
Template Guard plugin for Craft CMS đ
Password protect any page or entry in Craft CMS.
- Protect one or more pages.
- Protect multiple entries each with their own password.
- Customize the login page to match your site's design.
- Easily add log out button.
Quick start
Installation
Install the plugin via the plugin store or install manually using composer.
Usage
This plugin provides a protect
method in your templates, redirecting users to a login page.
Arguments
Password (string, array)
The password your users need to provide before accessing the page. You can also provide an array of passwords. The page will not be protected when the password is an empty string or array.
Key (string)
Identify a protected area on your site using the key argument. When logged in to a page with a specific key, other pages using the same key will also be accessible.
Examples
Protect a single page
Get started quickly by adding the following code to the template you want to protect.
You can also use a password stored on the entry.
Provide multiple passwords: any of the passwords provided in the array can be used to log in.
Protect multiple pages with the same password
The second argument (key) identifies a protected area on your site. When logged in to a page with a certain key, other pages using the same key will also be accessible.
Add this line to every template you want to protect with that password.
Protect multiple entries each with their own password
Add this line to the template(s) rendering your entries.
âī¸ Only templates with this line of code will be protected. Ensure your entry is not split across multiple pages.
Add log out button
âšī¸ Omit the hidden
key
input to log out from all template guard instances.
Configuration
Configure Template Guard via Settings â Plugins â Template Guard in the Craft Control Panel.
You can also create a configuration file: config/template-guard.php
.
License
This plugin requires a commercial license purchasable through the Craft Plugin Store.