A plugin for Kirby CMS.
- forces all users to login on non-panel pages
- redirects back to blocked page via urlParam after login
Especially useful for staging websites.
Inspired by WordPress plugin - Force Login
- Kirby 5.1+ (just tested with 5.1 probably works on previous versions too)
Download and copy this repository to /site/plugins/kirby-force-login.
composer require andrekelling/kirby-force-login
andrekelling.force-login.is-active supports bool and callable values in your config (for example in site/config/config.php).
return [
'andrekelling.force-login' => [
'is-active' => true,
],
];The callable should return true or false depending on your runtime checks.
return [
'andrekelling.force-login' => [
'is-active' => function (): bool {
if (!defined('SOMETHING') || SOMETHING !== true) return false;
$path = (string) kirby()->request()->path();
if (in_array($path, ['somepath', 'other/path', 'whatever/path.html'], true)) return false;
return true;
},
],
];MIT License Copyright © 2025 André Kelling