Hey there,
I wanted to include a checkbox with all users for a convenient way to add authors to articles and tried out users-field-plugin, but it seems to be broken …
In the backend, instead of a field, I get: Undefined property: UsersField::$exclude
When I add an exlude rule to the blueprint, I get: Undefined index: users
If I comment out the users line, I finally get the checkboxes with usernames and clearly the exclude for certain roles is working:
<?php
class UsersField extends CheckboxesField {
public function options() {
foreach(kirby()->site()->users() as $user) {
if (is_array($this->exclude['roles']) && in_array($user->role(), $this->exclude['roles'])) continue;
// if (is_array($this->exclude['users']) && in_array($user->username(), $this->exclude['users'])) continue;
$options[$user->username()] = $user;
}
return $options;
}
}
But for a plugin that’s endorsed on getkirbyplugins.com, it seems too broken.
Yes, there’s a check missing if the option is set. If you set the exclude options, it works as expected but fails if you don’t.
getkirby-plugins.com is not an official Kirby site. But even if it was, we can’t possibly test all plugins or give any guarantees that the code base is any good.