• Resolved pduke

    (@pduke)


    Hi, plugin worked fine until i decided to cut down few permissions for shop managers (the user group).
    I tried the “User Role manager” and “Publishpress capabilities” plugins in order to change permissions. Same result.
    First i perform a reset to permissions through Woocommerce->Status->Tools
    Button works fine.
    Then as soon as i disable “edit others” for Posts or pages, the sorting button in products page disappears for “Shop manager”.
    Any solution/advise?
    Woocommerce version 4.1

    cheers!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author SkyVerge

    (@skyverge)

    Hy @pduke!

    I checked the code briefly, and I couldn’t see anywhere that we check for specific capabilities such as the one you’ve mentioned. The only one I can see is where we check the user can “manage_woocommerce” but this appears to be for the back end options instead.

    I’d love to give this a test locally to see if there is anything I can suggest for you here. Would it be possible to let me know the exact name of the capabilities that you removed to cause the issue? Do you also see the sorting dropdown missing if you temporarily switch to a default theme such as TwentyTwenty?

    Cheers!

    Simon.

    Thread Starter pduke

    (@pduke)

    Hello Simon and thank you for your answer.
    My mistake that i didn’t clarify. I was reffering to the backend Sorting button in the horizontal menu at products page, not the drop down in the front end.
    Still i can’t find such capability in publishpress or anything similar in that matter. Also i can’t separate the plugin in “Type-Specific Capabilities” box cause it is not present.
    Any advise?
    i could do that manually i guess following your suggestions. (i mean from within the code)
    cheers!

    • This reply was modified 4 years, 6 months ago by pduke.
    • This reply was modified 4 years, 6 months ago by pduke.
    Plugin Author SkyVerge

    (@skyverge)

    Hey @pduke,

    Ahh, I see! Sorry for the confusion.

    Can you let me know what capabilities you were removing that caused the filter link to disappear? I can then run some more tests locally to see why that might be. As far as I can see, I don’t think we’re specifically checking for a capability, or adding our own, so not sure why it would be removed at the moment.

    If you can let me know how to replicate, I’ll see what I can find for you!

    Cheers,

    Simon.

    Thread Starter pduke

    (@pduke)

    Hi again!
    Please select capabilities for Shop Manger and disable Edit Others for Pages. Sorting button then disappears.
    Also i get these Invalid capabilies, if it is of any help
    Invalid Capabilities:
    delete badge
    delete product
    delete shop coupon
    delete shop order
    edit badge
    edit product
    edit shop coupon
    edit shop order
    read badge
    read product
    read shop coupon
    read shop order

    cheers!

    • This reply was modified 4 years, 6 months ago by pduke.
    Plugin Author SkyVerge

    (@skyverge)

    Hi @pduke,

    I was able to replicate the issue, thanks so much for sharing the steps. After a bit of digging, it looks to be a restriction within WooCommerce: https://github.com/woocommerce/woocommerce/blob/f2cce7f03780b2843f6b1b0e798dd952d51afb53/includes/admin/list-tables/class-wc-admin-list-table-products.php#L419-L419

    The Sorting filter will only be added when the current user can ‘edit_others_pages‘. I’m afraid this isn’t something our plugin is handling.

    Will you be leaving this capability enabled do you think or customizing the WooCommerce code instead?

    Cheers!

    Simon.

    Thread Starter pduke

    (@pduke)

    Hi Simon! thank you so very much for your time and findings. At last a solution. Although there is no common sense behind woocommerce’s team decision to use edit_others_pages capability, i wont waste any more minute on this. I already changed it to edit_pages. I ll deal with it in the future to be honest.
    One last thing if i may, does this mean that this button is not a feature of your plugin???

    Plugin Author SkyVerge

    (@skyverge)

    Hey @pduke,

    That’s great! I’m glad we reached a conclusion at least. While I don’t think the filter itself is part of our plugin, I think we do hook into its functionality to extend it with our plugin. Unfortunately, that means the output of it, is handled by WooCommerce and their associated capabilities.

    Glad to see you’re on your way now then! ?? Is there anything else I can help out with today?

    Cheers,

    Simon.

    Thread Starter pduke

    (@pduke)

    Ah ok, so i spent your time on … edit_others_work … really sorry about that mate, but actually excited that i bumped into you and we found a solution.
    I owe you one ??

    Nothing else then.
    Thanks a million once more Simon!

    Plugin Author SkyVerge

    (@skyverge)

    Hey @pduke,

    No problem at all! It’s always worth checking these things, and I didn’t know offhand immediately without looking, so it’s all good information to have for the future!

    I’ll mark this conversation as resolved now then, though if you have any other issues, please don’t hesitate to reach out ??

    Cheers,

    Simon.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Sorting button disappeared from Products page’ is closed to new replies.