Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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' );
}
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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