Skip Navigation

[Resolved] Disable access to Contact Form 7 plugin

This support ticket is created 3 years, 12 months 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Shane 3 years, 12 months ago.

Assisted by: Shane.

Author
Posts
#2283697

Hello,

You access plugin is working great, but we want to prevent translation roles to access Contact Form 7. How can we set this with you Toolset Access plugin?

See issue here: hidden link

Best,
Luc

#2283869

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Luc,

Thank you for getting in touch.

Unfortunately no our access plugin won't be able to do this but you should be able to use the code below to achieve your goal.

function remove_menu_pages() {

$user = wp_get_current_user();
if ( in_array( 'administrator', (array) $user->roles ) ) {
 remove_menu_page('wpcf7'); // Contact Form 7 Menu
    //The user has the "author" role
 }
}
add_action( 'admin_init', 'remove_menu_pages' );

Add the above code to your Toolset custom code settings at Toolset->Settings->Custom Code. Once you've done this please ensure that you've activated it as well as change the 'administrator ' to the role of the user.