Page Access

Use page gates to limit access to paid content like courses, lessons, or downloads.

Blueprint field

site/blueprints/pages/course.yml
title: Course

fields:
  gates:
    extends: fields/klub/gates/plans
  text:
    label: Content
    type: textarea

The field key defaults to gates and is defined by ProviderGates::$field.

Panel selection

Once provider plans are configured, the gates field lets you select price IDs directly in the Panel. Provider data is cached, so plan changes may take a few minutes to show up.

Template checks

<?php if ($page->isAllowed()): ?>
  <p>Allowed content</p>
<?php else: ?>
  <p>Upgrade to access this page.</p>
<?php endif ?>

You can also use the snippet:

<?php snippet('klub/allows', slots: true) ?>
  <?php slot('isAllowed') ?>
    <p>Allowed content</p>
  <?php endslot() ?>
  <?php slot('isNotAllowed') ?>
    <p>Upgrade to access this page.</p>
  <?php endslot() ?>
<?php endsnippet() ?>

Filtering page collections

<?php foreach ($page->children()->removeNotAllowed() as $child): ?>
  <a href="<?= $child->url() ?>"><?= $child->title() ?></a>
<?php endforeach ?>
Kirby Klub is not affiliated with the developers of Kirby CMS. We are merely standing on the shoulder of giants.
© 2026 Bruno Meilick All rights reserved.