Tagged: ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2479
    jawad
    Participant

    Hi there,

    I have updated: https://wordpress.org/plugins/yith-woocommerce-wishlist/ to the latest version and this bug has been present since.

    I am unable to hide ‘YITH Plugins’ from the Admin Menu as I am not given the option to block this menu item?

    Many Thanks,
    Jawad

    #2486
    Vladimir
    Keymaster

    Hi Jawad,

    ‘Yith Plugins’ menu is protected by ‘manage_options’ capability. This menu is not shown in ‘Admin menu’ dialog in case a role does not have ‘manage_options’ capability.

    #2490
    jawad
    Participant

    Hi Vladimir,

    Thanks for your reply. Can you please check again after updating to there latest WooCommerce Wishlist free plugin linked earlier.

    I have unchecked ‘manage_options’ but the parent YITH plugin menu option is still appearing on the admin menu?

    Many Thanks,
    Jawad

    #2491
    Vladimir
    Keymaster

    Hi Jawad,

    It’s a bug of that plugin, which shows its empty menu to any user without ‘manage_options’ capability. Until it’s not fixed by developer you may remove this menu item for all users without ‘manage_options’ capability by adding this code into the active theme functions.php file or setup it as a must use plugin:

    
    add_action('admin_menu', 'yit_menu_fix', 100);
    
    function yit_menu_fix() {
      
      if (!current_user_can('manage_options')) {
        remove_menu_page('yit_plugin_panel');
      }
      
    }
    
    
    #2659
    AGB
    Participant

    Hi Vladimir, we had that problem with the YITH menu item, and the code you provided here fixed it (thanks)! However we are having the same issue with another plugin, the Vehicle Parts Finder. It remains as an empty menu item for roles that aren’t allowed access.

    Can you please help by explaining how we may adjust that code to apply to this VPF plugin? Can yit_menu_fix simply be changed to vpf_menu_fix in both places? And change ‘yit_plugin_panel’ to ‘vpf_makes’?

    (By inspecting code for YITH menu item, I found class and id of the li tag to be “toplevel_page_yit_plugin_panel”. For VPF menu item, it is “toplevel_page_vpf_makes”, so that is where I got that term from.)

    Thanks so much.

    #2660
    Vladimir
    Keymaster

    Hi,

    Look for “add_menu_page(” at the plugin code. You will find menu slug and capability among parameters, which are ‘yit_plugin_panel’ and ‘manage_options’ for the YITH plugin.
    So look for similar values at the VPF plugin code.

    Yes, you may use a copy of a code provided and change ‘yit_menu_fix’ to ‘vpf_menu_fix’ and replace tag and capability inside function to the related to VPF plugin you found at its code.

    #2662
    AGB
    Participant

    Perfect; thank you Vladimir. Just what I needed.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.