Add User Field Configuration through Registry

Hi Kirbies

I haven’t found an option to add custom user fields through the Plugin Registry and kindly ask to evaluate this as an addition to the upcoming extended 2.4.0+ user role features.

Thanks a lot for all your work,
Moritz

You should be able to do this already:

kirby()->set('blueprint', 'users/admin', __DIR__ . DS . 'blueprints' . DS . 'users' . DS . 'admin.yml');

It was missing from the registry docs, I have added it now. :slight_smile:

Hi @lukasbestle

Thanks a lot. Works like a charm.

You rock,
Moritz

Oh, one more question; what about introducing a blueprints/users/default.yml for roles missing a specific user field definition file?

I have added an issue on GitHub.

Thanks a lot. In the meantime I solved this with this code snippet:

// Configure all roles to share the same user fields
foreach ($kirby->get('option', 'roles') as $key => $role) {
  kirby()->set('blueprint', 'users/' . $role['id'], __DIR__ . DS . 'blueprints' . DS . 'users' . DS . 'default.yml');
}

This feature (it was one line to implement) will be in Kirby 2.4.0, it’s already on the develop branch. :slight_smile:

1 Like