• Hey All,

    I have the following code… this is an options page for use by Editors, however when the editor clicks save they get the error: “Cheatin’ uh?”

    Having looked around I see the problem is I am using options.php and because the editor is not an admin it wont allow it? Am I correct? And how can I fix this?

    Thanks,
    Dan

    <?php
    // create custom plugin settings menu
    add_action('admin_menu', 'ticker_create_menu');
    
    function ticker_create_menu() {
    	//create new top-level menu
    	//add_menu_page('Ticker Tape', 'Ticker Tape', 'editor', 'ticker-trape', 'ticker_settings_page', NULL);
    	add_submenu_page('index.php', 'Ticker Tape', 'Ticker Tape', 'edit_theme_options', 'ticker-tape', 'ticker_settings_page' );
    
    	add_action('admin_init', 'register_ticker' );
    }
    
    function register_ticker(){
    	//register our settings
    	register_setting('ticker_settings', 'ticker_settings');
    }
    
    function ticker_settings_page() {
    ?>
        <div class="wrap">
        <div id="icon-options-general"></div>
        <h2>Website Ticket Tape</h2>
    
    	<?php
        //show saved options message
        if($_REQUEST['settings-updated']) : ?>
        <div id="message" class="updated below-h2"><p><?php _e( 'Options saved' ); ?></p></div>
        <?php endif; ?>
    
        <form method="post" action="options.php">
            <?php settings_fields('ticker_settings'); ?>
    		<?php $options = get_option('ticker_settings'); ?>
            <?php $ischecked = ($options['status'] == "1" ? "checked" : ""); ?>
    
            <table class="form-table">
                <tr valign="top">
                    <th scope="row">Ticker On / Off</th>
                    <td><input name="ticker_settings[status]" type="checkbox" id="ticker_settings[status]" value="1" <?php esc_attr_e($ischecked); ?> /></td>
                </tr>
    
                <tr valign="top">
                    <th scope="row">Ticker Text</th>
                    <td><textarea name="ticker_settings[text]" cols="60" rows="5" id="ticker_settings[text]" class="regular-text"><?php esc_attr_e($options['text']); ?></textarea></td>
                </tr>
    
                <tr valign="top">
                    <th scope="row">Ticker URL</th>
                    <td><input type="text" name="ticker_settings[url]" value="<?php esc_attr_e($options['url']); ?>" class="regular-text" /></td>
                </tr>
            </table>
    
            <p class="submit">
            <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
            </p>
    
        </form>
        </div>
    <?php }
Viewing 1 replies (of 1 total)
  • Can you replicate the problem using the default Twenty Fourteen theme with all plugins deactivated?

Viewing 1 replies (of 1 total)
  • The topic ‘Options.php Cheatin’ uh?’ is closed to new replies.