• Resolved LoicTheAztec

    (@lomars)


    Hello Sybre,

    It’s a long time… I see that your plugin is becoming very popular. Congratulations!

    I have installed your plugin on a fresh new WordPress/WooCommerce web site.

    The Problem:
    On WooCommerce websites, there is 2 specific custom user roles, the “customer” and the “shop_manager”.
    The “shop_manager” can’t access to your plugin settings as it’s not a classic user role.

    Question:
    There is a hook or a way to extend admin access for your plugin settings to a custom role as “shop_manager”? Or in which PHP file of your plugin could I include this user role?

    May be you could plan in a future update to add this role in your plugin, as WooCommerce is a really popular plugin.

    In advance, thanks for your answer.

    Loic

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

    (@cybr)

    Hi Loic,

    It indeed has been, and thanks! ??

    There’s a filter available for adjusting the SEO Settings access required role, which is: the_seo_framework_settings_capability. This filter has been added in 2.6.0.

    Currently, it’s defaulted to manage_options.
    I have a few customers myself who I believe should access all things “shop”, but not “site settings”. They have little to no knowledge of WordPress, let alone how websites work.
    Incorrectly setting up SEO Settings can be quite harmful for the site, and then who’s to blame? :’)

    Nevertheless, you can add the following code to your theme’s functions.php file or within your own plugin:

    
    add_filter( 'the_seo_framework_settings_capability', 'my_shop_manager_seo_access' );
    function my_shop_manager_seo_access( $default = 'manage_options' ) {
    	return 'shop_manager';
    }

    I have not tested this filter, but I believed it worked as intended already for someone else.

    I hope this helps! Cheers!

    Thread Starter LoicTheAztec

    (@lomars)

    Hello Sybre,

    Yes that is the hook that I need, Thanks you. This is perfect. Your plugin is very well maid ??

    Here in this web site, I don’t want to give admin access to the people that are managing SEO and they are also the “shop manager” WooCommerce (custom) role. So in all cases your hook is perfect!
    If that “shop manager” scramble the SEO settings for their web site, is their responsibility…

    Thanks a lot for your lightening responses

    Lo?c

    Hey there,

    Is there any way I could add two roles for this capability?

    I’ve tried returning an array(‘administrator’, ‘editor’);

    But this doesn’t seem to work ?? Any help would be greatly appreciated.

    Cheers,

    Thread Starter LoicTheAztec

    (@lomars)

    Hello

    For you the best way should be to use capabilities instead of user roles. The common capability for “editor” and “administrator” user roles is: edit_pages

    So you could try:

    add_filter( 'the_seo_framework_settings_capability', 'my_shop_manager_seo_access' );
    function my_shop_manager_seo_access( $default = 'manage_options' ) {
    	return 'edit_pages';
    }

    Ah I see! Perfect! Thanks very much Loic, worked a treat.

    Thread Starter LoicTheAztec

    (@lomars)

    You are just welcome

    LoicTheAztec

    The aforementioned way to allow users with other capabilities than the default manage_options to access the seo framework settings only makes it possible to view the settings, but not to make any changes on it.

    i think that’s because the settings are saved by sending a post request to vanilla wordpress options.php script.

    @cybr, @lomars can you approve this? did you solve this in any way? because only viewing the settings isn’t enough for my shop managers ??

    thanks in advance for your help!
    matthias

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi @patchekohoss,

    Thanks for informing us!

    I’ve created a GitHub issue and will investigate it soon:
    https://github.com/sybrew/the-seo-framework/issues/196

    ok. thanks. i’ll follow the issue there

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘The SEO Framework and WooCommerce Shop manager user role’ is closed to new replies.