Add user role shop_manager to capabilities filter
-
Hi,
I’m currently trying to add all the atum capabilities programmatically to the user_role “shop_manager”.I found the following snippet by one of the plugin authors in another closed topic:
add_filter('atum/capabilities/admin_roles', function($roles) { $roles[] = get_role('shop_manager'); return $roles; });
Unfortunately this did not work. Also changing priority, or rewriting the code with an array_merge did not help.
Adding get_role(‘shop_manager’) to the array inside the AtumCapabilities class constructor made it work though:
$admin_roles = (array) apply_filters( 'atum/capabilities/admin_roles', [ get_role( 'administrator' ), get_role( 'shop_manager' ) ] );
This of course is not a feasible solution when we update the plugin in the future.Would you know what is wrong with the snippet? I can’t seem to find out what the problem is…
kind regards
Jan
- The topic ‘Add user role shop_manager to capabilities filter’ is closed to new replies.