Team Control extension: Hide few items of left Menu Bar on MainWp Dashboard

Hello, everyone!
I have created a custom user role named “mm_user” by using the “Team Control” extension.
And I want to leave only these 3 items on the left menu bar: “Overview”, “Update”, and “Sites” for “mm_user” role.

I tried to follow this link - (Team Control extension: hide some Menus) but it didn’t work for me.

Please help me kindly
Thank you

Hi @YuXiang8510

In the IF statement, try using the ID of the “mm_user” role.
You can see the ID in the wp_mainwp_roles table in the database. For example:

Hello, Bojan.
Thank you for your reply.
I found the ID of the “mm_user” role in the database.
It is named like as “mainwp_mwpuser” - (screenshot - Screenshot by Lightshot)
So I added this code in the functions.php file but I’m still accessing this link - Log In ‹ ☘️ Casinos Portal ☘️ — WordPress

if ( current_user_can( ‘mainwp_mwpuser’ ) ) {
add_filter( ‘mainwp_main_menu_disable_menu_items’, ‘mycustom2_mainwp_main_menu_disable_menu_items’ );
if ( !function_exists( ‘mycustom2_mainwp_main_menu_disable_menu_items’ ) ) {
function mycustom2_mainwp_main_menu_disable_menu_items( $disable_menus ) {
if (isset( $disable_menus[‘level_2’][‘UserBulkManage’]) ){
$disable_menus[‘level_2’][‘UserBulkManage’] = true;
}
return $disable_menus;
}
}
}

What is wrong?

So I added this code in the functions.php file but I’m still accessing this link - …/wp-admin/admin.php?page=UserBulkManage

Do you have any idea?

This is the screenshot that is showing my code snippet in the functions.php of the child theme

Hello, Bojan.
I added above php code snippet by using Custom Dashboard Extension and it works like a charm.
Thank you again

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.