Skip Navigation

[Resolved] Can’t hide toolset in dashboard menu

This thread is resolved. Here is a description of the problem and solution.

Problem:
Can't hide toolset in dashboard menu

Solution:
You can use "admin_menu" action hook to hide the dashboard menu from Toolset.

You can find the proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/cant-hide-toollset-in-dashboard-menu/#post-1161494

Relevant Documentation:

This support ticket is created 6 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 3 replies, has 3 voices.

Last updated by zbyszekZ 6 years ago.

Assisted by: Minesh.

Author
Posts
#1161486

I am trying to: hide toolset menu from administration sidebar, when working the onle administrators have access to TOOLSET


function remove_menus(){
  remove_menu_page( 'index.php' );                  //Dashboard
  remove_menu_page( 'about.php' );                  //welcome 
  remove_menu_page('wpcf');   //have tried this as an types example also not working
  remove_action('welcome_panel', 'wp_welcome_panel');
    if( !current_user_can( 'administrator' ) ) {
        remove_action( 'admin_menu', 'cptui_plugin_menu' );
    }
}
add_action( 'admin_menu', 'remove_menus' );
add_filter('show_admin_bar', '__return_false');

Link to a page where the issue can be seen:
user login restricted
I expected to see:
toolset menu been removed (could be as if not administrator)
Instead, I got: toolset TOOLSET menu still visible

#1161494

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - could you please try to use the following code, add that to your current theme's functions.php file:


function remove_toolset_menus(){
	global $current_user;
	
    if(!in_array('administrator',$current_user->roles)) {
		remove_menu_page('toolset-dashboard'); 
	}
}
add_action( 'admin_menu', 'remove_toolset_menus' , PHP_INT_MAX );

If you don't want to add custom code to your current theme's function.php file, Toolset also offers a place where you can add your custom code. Please check following Doc:
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/

#1161653

My issue is resolved now. Thank you!

#1622147

Hi Minesh,
I have the same problem. I would like to hide Toolset from administration sidebar for my custom roles.
I created this role via copy of administrator role.
I added your code in this way => https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/
Run it and enabled, but Toolset is still visible in this menu in this custom role user 🙁

Please write me how can I fix it.

Best regards!

New threads created by Minesh and linked to this one are listed below:

https://toolset.com/forums/topic/split-cant-hide-toolset-in-dashboard-menu-hide-it-for-custom-roles/