Member Count

Stats Report

The Klub plugin ships with a report you can add to Stats sections to display the current and available member count. Until you deploy Klub to your production environment and the license check runs at least once, the report will show 0/0.

site/blueprints/site.yml
sections:
  stats:
    label: Stats
    type: stats
    reports:
      - site.klub.stats

Notifications with Hooks

The Klub plugin will throw a PHP exception once you hit the maximum number of members your license allows. To avoid your service being interrupted you could listen to the klub.member.created or the klub.license.check hooks and send yourself a notification.

site/config/config.php
<?php

return [
   'hooks' => [
       'klub.license.checked' => function ($members, $maxMembers) {
          if ($members/$maxMembers > 0.9) {
              klub()->notify(
                 'my_hook.license_upgrade',
                 expire: 60*24 // once per day
              );
          }
       },
       'my_hook.license_upgrade' => function() {
           // TODO: send yourself an email/sms
       },
   ],
   // other options
];
A klub.license.failed-hook allows you to react to the fact that the Klub plugin is disabled.
Kirby Klub is not affiliated with the developers of Kirby CMS. We are merely standing on the shoulder of giants.
© 2024 Bruno Meilick All rights reserved.