Change WordPress user roles and capabilities › Forums › Give user access to plugin – how to › Enable Access to Amelia Plugin › Reply To: Enable Access to Amelia Plugin
16/12/2020 at 13:33
#7216
Vladimir
Keymaster
You have to take into account that Amelia plugin create its admin menu “Amelia” with submenu items only for user who has at least one of Amelia’s user roles or who is a superadmin:
$ameliaRole = UserRoles::getUserAmeliaRole(wp_get_current_user());
// Init menu if user is logged in with amelia role
if (in_array($ameliaRole, ['admin', 'manager', 'provider', 'customer'])) {
if ($ameliaRole === 'admin') {
ErrorService::setNotices();
}
$menuItems = new Menu($settingsService);
where:
– ‘admin’=’administrator’ WordPress role;
– ‘manager’=’wpamelia-manager’;
– ‘provider’=’wpamelia-provider’;
– ‘customer’=’wpamelia-customer’.
So you can use your own custom user role but grant it to a user together with one of Amelia own user roles from the list above.