Change WordPress user roles and capabilities › Forums › How to or FAQ › Allow WooCom Order Filtering, w/out Posts Admin Menu Access
Tagged: Order Filter, Posts Admin Menu, woocommerce
- This topic has 5 replies, 2 voices, and was last updated 8 years, 1 month ago by Vladimir.
-
AuthorPosts
-
27/09/2016 at 19:55 #2793AGBParticipant
Hello Vladimir,
I am referring to your article about ure_admin_menu_access_allowed_args. I’m having trouble applying it how I need. Specifically I’m not sure about the argument to use (in place of ‘scope’ in your example).Basically, some of our internal roles have edit_posts and create_posts capabilities, to be able to Create/Add Orders in WooCommerce, for example. However using the URE Admin Menu module we have blocked Posts item entirely from the menu for their roles as they have No need to access those. Because of that, these roles are not able to use the Filter in Woo Orders screen, to filter by Date or Customers.
As a temporary solution I had to unblock Posts from the Admin menu.
I appreciate your help!
28/09/2016 at 02:54 #2795VladimirKeymasterHi,
Thanks for paying my attention on this problem.
It depends from what filter you will use (may be use have some custom filters).
In order to allow WC to use a filter by customer wee need to mark as ‘allowed’ the ‘_customer_user’ URL parameter, like this:add_filter('ure_admin_menu_access_allowed_args', 'allow_events_filter', 10, 1); function allow_events_filter($args) { $args['edit.php'][''][] = '_customer_user'; return $args; }
I will add the support for this argument directly to User Role Editor Pro with the next update.
In general ‘edit_posts’ capability is not required to allow work with WC Orders. This custom post type has its own set of user capabilities – ends with ‘_shop_orders’.
WooCommerce does not allow access to backend to any user without ‘manage_woocommerce’ or ‘edit_posts’ capability. But there is a workaround for this.
So you will not need to block access to “Posts” menu it this case.28/09/2016 at 04:54 #2796VladimirKeymasterI will add the support for this argument directly to User Role Editor Pro with the next update.
Done for the development version 4.29.b4. It’s available for testing from the “Download” page.
28/09/2016 at 05:07 #2797AGBParticipantGreat; thanks again. I will try it out!
28/09/2016 at 07:00 #2798AGBParticipantHi Vladimir,
I replaced our 4.28.2 version with the development version 4.29.b4 (on a testing site). Immediately the issue was resolved – awesome; thanks! To initially test, I simply blocked all the Posts menu items again, via the Admin Menu module (for the affected roles). Those roles no longer see the Posts menu item, and are still able to filter WC orders by Date, Customer, etc. Great!I remain curious about one thing: you mention that ‘edit_posts’ capability is not required to allow work with WC Orders. Recently during development, I think I had our internal roles set up like that (at least briefly). Those roles could Add/Create orders without any Posts capability. We are now on live site (launched yesterday) and all plugin versions & usage are same as before. However now these internal roles cannot Create orders unless I give them ‘edit_posts’ AND ‘create_posts’ capabilities. I’m not sure why. Also it is not really a problem now for daily operations, once we can put 4.29.b4 “stable” version on live site… But I want to figure out how to Not have those Posts capabilities enabled, since I have to then block them.
For example, our Sales role has the following WC capabilities allowed:
create_shop_orders
edit_others_shop_orders
edit_published_shop_orders
edit_shop_order
edit_shop_orders
manage_woocommerce
publish_shop_orders
read_shop_orderThey also have general ‘read’ of course, and have ability to ‘create_users’, ‘edit_users’ and ‘list_users’ as well.
With that setup… (plus usage of Admin Menu and Meta Boxes modules to deny additional things)… they cannot Add New Order. IF I also apply those two Posts capabilities (edit and create), then they are able to Add New Orders.
Please let me know why this may be? Thank you!
28/09/2016 at 07:24 #2799VladimirKeymasterI may only suppose that some difference in the plugins list/settings exist. At my tests role with these capabilities:
create_shop_orders
delete_others_shop_orders
delete_private_shop_orders
delete_published_shop_orders
delete_shop_orders
edit_others_shop_orders
edit_private_shop_orders
edit_published_shop_orders
edit_shop_orders
publish_shop_orders
read_private_shop_ordersworks with orders (may add a new order) without problem too.
Try to deactivate all plugins except WC and URE. Check if some ‘must use’ plugin works or ‘functions.php’ from the active theme was modified and contains some related code.
-
AuthorPosts
- You must be logged in to reply to this topic.