• Resolved itjbind

    (@itjbind)


    Hi there,

    I am trying to hide the admin link under products to extra product options. I need to hide it so my shop managers do not go in there and change the fields that we have created. I was able to hide other admin menu items, but it seems I can’t hide your link. Any help would be appreciated. Attached is the code that I have used, which has worked for other items.

    <?php
    add_action( 'admin_menu', 'remove_menu_pages', 999);
    function remove_menu_pages() {
    global $current_user;
      
    $user_roles = $current_user->roles;
    $user_role = array_shift($user_roles);
    if($user_role == "print_shop_staff") {
    	$remove_submenu = remove_submenu_page('woocommerce', 'th_checkout_field_editor_pro');
    	$remove_submenu = remove_submenu_page('woocommerce', 'wc-settings');
    	$remove_submenu = remove_submenu_page('woocommerce', 'wc-status');
    	$remove_submenu = remove_submenu_page('woocommerce', 'wc-addons');
    
    }
    }
    ?>

    This the code I tried to use to hide link from admin menu, but it did not work.
    $remove_submenu = remove_submenu_page('products', 'thwepof_extra_product_options');

    • This topic was modified 5 years, 1 month ago by itjbind.
    • This topic was modified 5 years, 1 month ago by itjbind.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author ThemeHigh

    (@themehigh)

    By default, we are adding the plugin based on the capability manage_woocommerce. That means this capability also provides shop managers with access to the plugin settings.

    In the next version of our plugin, we will provide a filter to change the capability. Using this filter you can set it to admins only.

    We will let you know once the plugin with this filter is released.

    Thank you!

    Thread Starter itjbind

    (@itjbind)

    Oh great! When do you expect the next version to be released? Before 2020?

    Plugin Author ThemeHigh

    (@themehigh)

    We are planning to release an update of the plugin on this month.

    Thank you!

    Thread Starter itjbind

    (@itjbind)

    Hi there,

    I saw you updated the plugin, but I do not see any settings to filter who has access to it.

    “Filter to modify plugin settings access capability.”

    If you could show me where this is located that would be great.

    Plugin Author ThemeHigh

    (@themehigh)

    You need to add the below filter in your child theme’s functions.php inorder to make the plugin settings accessible only for the admin.

    function thwepof_required_capability($capability){
        return 'manage_options';
    }
    add_filter( 'thwepof_required_capability', 'thwepof_required_capability');

    We hope this will help.

    Thank you!

    Thread Starter itjbind

    (@itjbind)

    Hi there,

    I added the exact code and it didn’t work. It broke the site. I assume something is missing. Any suggestions?

    Also, maybe in a future update you can just add a check box or a toggle in the settings of the plugin to control what user roles have access to it.

    Thread Starter itjbind

    (@itjbind)

    Hi there,

    I tried it again and it worked! I must not have pasted the code in properly. Thank you for this.

    Again though, maybe in a future update you can just add a check box or a toggle in the settings of the plugin to control what user roles have access to it.

    Thank you for your help

    Plugin Author ThemeHigh

    (@themehigh)

    We have forwarded your suggestion to our development team. They will check the feasibility of adding this in the future versions.

    Thank you!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Hide Extra Product Option Link from admin menu’ is closed to new replies.