Change WordPress user roles and capabilities › Forums › Bug Reports › YITH Plugin Admin Menu
- This topic has 6 replies, 3 voices, and was last updated 8 years, 1 month ago by AGB.
-
AuthorPosts
-
02/07/2016 at 00:55 #2479jawadParticipant
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,
Jawad02/07/2016 at 13:47 #2486VladimirKeymasterHi 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.
04/07/2016 at 12:17 #2490jawadParticipantHi 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,
Jawad05/07/2016 at 02:56 #2491VladimirKeymasterHi 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'); } }
25/08/2016 at 21:58 #2659AGBParticipantHi 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.
26/08/2016 at 00:59 #2660VladimirKeymasterHi,
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.
26/08/2016 at 18:24 #2662AGBParticipantPerfect; thank you Vladimir. Just what I needed.
-
AuthorPosts
- You must be logged in to reply to this topic.