andrekelling/kirby-force-login

Force Login

Maintainers

Package info

github.com/AndreKelling/kirby-force-login

Type:kirby-plugin

pkg:composer/andrekelling/kirby-force-login

Statistics

Installs: 122

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

1.1.0 2026-06-18 09:16 UTC

This package is auto-updated.

Last update: 2026-06-18 09:24:43 UTC


README

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

Requirements

  • Kirby 5.1+ (just tested with 5.1 probably works on previous versions too)

Installation

Download

Download and copy this repository to /site/plugins/kirby-force-login.

Composer

composer require andrekelling/kirby-force-login

Usage

andrekelling.force-login.is-active supports bool and callable values in your config (for example in site/config/config.php).

Bool example

return [
    'andrekelling.force-login' => [
        'is-active' => true,
    ],
];

Callable example

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;
        },
    ],
];

License

MIT License Copyright © 2025 André Kelling