WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
Hide contact form settings in admin panel for editors (14 posts)

  1. Tom
    Member
    Posted 4 years ago #

    I've been using your plugin for sometime on my own site, but I've just built a site for someone and I'm using adminimize to hide certain things from another user of the the site with the 'editor' title. Adminimize allows me to hide everything that I need to from the editor, whilst remaining viewable to myself (admin)... however, I cannot hide 'Contact'- the contact form 7 settings.

    I'm guessing that it's because 'contact' appears in its very own menu item in the admin panel, instead of being under the 'settings' options.

    How do I relocate it to there?

    Thanks

    http://wordpress.org/extend/plugins/contact-form-7/

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 4 years ago #

  3. Tom
    Member
    Posted 3 years ago #

    I have looked and tried that, but it doesnt work- editors can still access it.

  4. mikono
    Member
    Posted 3 years ago #

    Hi, i use the plugin adminimize to manage access/visibility over my complete backend. It works fine for me with contact-form as well.. hope that will help

  5. Tom
    Member
    Posted 3 years ago #

    I also use Adminimize, but For some reason Contact Form 7 doesn't appear in the list.

    However, the code given here: http://contactform7.com/2009/11/18/restricting-access-to-the-administration-panel-2/

    ..Did actually work. It seems I had to move it closer to the top of the file (wp-config.php).

    Anyway cheers for the help guys.

  6. cruxwireweb
    Member
    Posted 3 years ago #

    Where in wp-config.php did you put them? It's not working for me. Thanks.

  7. cruxwireweb
    Member
    Posted 3 years ago #

    Oh, but I'm not using Adminimize - I wonder if that matters.

  8. Tom
    Member
    Posted 3 years ago #

    I suppose the positioning of where you add the code depends what other stuff you have in that file (wp-config.php). I for one, have a fair bit of custom stuff in there. Just have a play around, positioning it in different places- trial & error.

  9. cruxwireweb
    Member
    Posted 3 years ago #

    Did you keep the lines of code together, or split them up, Jeffrey?

    Thanks,
    Kim

  10. Tom
    Member
    Posted 3 years ago #

    keep it together. Below I'll post a snippet of the code from my wp-config file to give you an idea of where it should go...

    /** Database Charset to use in creating database tables. */
    
    define('DB_CHARSET', 'utf8');
    
    /** The Database Collate type. Don't change this if in doubt. */
    
    define('DB_COLLATE', '');
    
    /** Allow only admins to see contact form 7 settings in admin panel */
    define( 'WPCF7_ADMIN_READ_CAPABILITY', 'manage_options' );
    define( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY', 'manage_options' );
    
    /**#@+
    
     * Authentication Unique Keys and Salts.
  11. cruxwireweb
    Member
    Posted 3 years ago #

    That worked, Jeffrey! Thank you very much, and I'm glad this extra detail is here for posterity. :)

  12. Tom
    Member
    Posted 3 years ago #

    No problem, glad you got it working :)

  13. graphys
    Member
    Posted 3 years ago #

    Hello, why not just adding a few lines of code in the function.php file rather than the wp-config.php :

    function remove_contact_menu () {
    global $menu;
    	$restricted = array(__('Contact'));
    	end ($menu);
    	while (prev($menu)){
    		$value = explode(' ',$menu[key($menu)][0]);
    		if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
    	}
    }
    add_action('admin_menu', 'remove_contact_menu');
    if(!current_user_can('level_10')) {
    	add_action('admin_menu', 'remove_contact_menu');
    }

    It works great!

  14. baga
    Member
    Posted 3 years ago #

    Hello, why not just adding a few lines of code in the function.php file rather than the wp-config.php

    Hi graphys you're right, it would be better to edit the functions.php file rather than wp-config.php but the code you posted above doesn't work for me: editors can still see the Contact Form settings.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic