0

I have a theme-options.php file and am trying to grant Editor users access to edit it.

I've managed to give them access to the page itself by modifying the parameters in this function to include 'moderate_comments':

function theme_options_add_page() {
    add_theme_page( __( 'Theme Options', 'sampletheme' ), __( 'Theme Options', 'sampletheme' ), 'moderate_comments', 'theme_options', 'theme_options_do_page' );
}

However, when I try to edit / save the options, I get given a message saying:

Cheatin’ uh?

Can anyone see what the issue is?

Here is the code for my options file if that helps! - http://pastebin.com/uEYJax4M

2

The problem is that the default Editor role does not have enough capabilities to change theme options. You are allowing users with 'moderate_comments' capabilities to view the page. That in itself is not enough. When the user attempts to update, it fails because the user does not have the proper capabilities, hence the 'Cheatin’ uh?' message. I believe you need to give Editors 'manage_options' capabilities and possibly others. You can achieve this using various WP plugins that can change role or user capabilities. Here is one that I have used - http://wordpress.org/plugins/user-role-editor/

Your function to add the option menu page should only be viewable to users with 'manage_options' capability

function theme_options_add_page() {
    add_theme_page( __( 'Theme Options', 'sampletheme' ), __( 'Theme Options', 'sampletheme' ), 'manage_options', 'theme_options', 'theme_options_do_page' );
}
  • that worked perfectly thanks! Strangely though it then meant the Editor role had access to plugins (but only Akismet) and settings. I got around that by using the Adminimize plugin though – pealo86 Nov 29 '13 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.