[Resolved] "Cheatin' Uh?" – Editor Accessible Settings Page
Please be assured I’ve done a fair amount of searching and have only found outdated and unsolved posts on this topic.
I want to give my editors access to a custom settings page which I created with the following line of code:
add_menu_page('Theme Settings', 'Theme Settings', 'edit_pages', basename(__FILE__), 'my_settings_page', get_bloginfo('template_directory') . '/images/icon_16.png');
This gives them access to the page (link shows up in menu) but when they try to save the settings, the infamous “Cheatin’ uh?” message is displayed. I’ve tried finding a capabilities manager plugin to give access but no luck for custom pages.
Most of the posts I found on the topic were for very old versions of WP and I’m hoping the issue has a solution in 3.0.4 (or 3.1?).
Any help is appreciated.
I’ve tried several capability/role manager plugins with no luck. With Capability Manager, I created a custom capability called
and used it like this:
add_menu_page('Theme Settings', 'Theme Settings', 'manage_custom_settings', basename(__FILE__), 'my_settings_page', get_bloginfo('template_directory') . '/images/icon_16.png');
You need to use the correct capability.
add_menu_page('Theme Settings', 'Theme Settings', 'edit_theme_options', basename(__FILE__), 'my_settings_page', get_bloginfo('template_directory') . '/images/icon_16.png');
If that doesn’t work, then you need to choose a capability available to users with the “Editor” role, or else use a capability/role manager plugin to give the “Editor” role the “edit_theme_options” capability.
Thanks for your reply. I tried giving the capability
to editors via Capability Manager but I am still getting the “Cheatin'” message when trying to save… I can see the menu item, get to the page, but can’t update options. I also tried
edit_themesbut no luck. It appears to work only when I give the full
manage_optionscapability… but that is far too much power to give to my editors.
It seems there is something preventing the full permission of updating the settings even though the user has the capability required by the page (
Long shot, but can you try using add_theme_page() rather than add_menu_page()?
And line 30 of wp-admin/options.php says it all:
if ( !current_user_can('manage_options') )
This is preventing saving any options without the
manage_optionscapability. If only there were a hook here to make an exception for certain options…
Something else is going on here.
There are many, many Themes (including my own) that use the “edit_theme_options” capability for Theme Settings pages, with no issues whatsoever.
What are you doing on submit of your Settings page form?
I built my options page just as this example (which was linked from a codex article).
I’m sure there are many themes using these features but the problem is that I need an Editor to be able to use it… from that line in
wp-admin/options.phpI can tell that you MUST have the
manage_optionscapability to POST the options form to the options.php page. My solution will be to have the form submit to the page itself (rather than options.php) and I’ll process the submission from there.
Can you post your entire Theme Options code into a paste bin?
I’ve recently run into the exact same issue with an options page for my users, and it’s causing considerable frustration… I used the same example and I’ve spent the last two days thoroughly vetting my code with lots of little “echo hey I’m here” type statements, and as near as I can tell it should be working for users with non-administrator privileges, but it ain’t.
So I figure either my understand is flawed (probable), the code is flawed (possible) or there’s a hole in the universe that’s sucking non-administrative permissions into it.
…I notice you haven’t posted for a couple weeks. Does this mean you found a solution? (Please oh please fulfill my daylight-savings day wish!)
I think I may have figured out my own issue… I think I was using kind of a bastardized way of getting input from the menu in to the options database, i.e. by posting to options.php:
?> <form action="options.php" method="post"> <?php settings_fields($report_user_input); ?> <?php do_settings_sections(__FILE__); ?> <p class="submit"> <input name="Submit" type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes'); ?>" /> </p> </form> <?php
But I think this is the way to do it (i.e. the examples: Sample Menu Page) http://codex.wordpress.org/Administration_Menus
Hope this works for me!
I have this exact issue and I use the new settings API to create options page for my users.
I am using Otto’s great tutorial for this and the form must POST to options.php in order to save the options to the database, when using the settings API.
Solution of @smconner to use the administration menu solves this, but wouldn’t let use the settings API, but use the old way of administration menus.
So, it appears that editor must have manage_options capability to save the settings, but of course I don’t want to grant editor this capability.
If any ideas about that, I will be happy …
- The topic ‘[Resolved] "Cheatin' Uh?" – Editor Accessible Settings Page’ is closed to new replies.