Multiple roles for members

Multiple Roles

In some use-cases it might be beneficial to have multiple roles for members not just the default one named member.

For instance, you could allow some members access to certain parts of the Panel.

The config allows you to define multiple possible roles. The first one will be used as default when automatically creating new members.

site/config/config.php
<?php

return [
  'bnomei.klub.manageUsers.role' => ['member', 'pro'],
  // other options
];

Assigning Roles

The recommended way to assign roles based on the new products or subscriptions owned by your members is to utilize the hooks triggered by this plugin. You can query the session array returned from Stripe to decide what to do.

site/config/config.php
<?php

return [
  'hooks' => [
     'stripe.recurring:after' => function (User $user, array $session) {
        if (A::get($session, 'TODO TODO')) {
           $user->changeRole('pro');
        }
     }
  ],
  // other options
];
Kirby Klub is not affiliated with the developers of Kirby CMS. We are merely standing on the shoulder of giants.
© 2025 Bruno Meilick All rights reserved.