[wp-trac] [WordPress Trac] #7277: page_options doesn't work for
plugin pages
WordPress Trac
wp-trac at lists.automattic.com
Thu Jul 10 14:16:25 GMT 2008
#7277: page_options doesn't work for plugin pages
---------------------+------------------------------------------------------
Reporter: Mr Pete | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.7
Component: General | Version:
Severity: normal | Keywords:
---------------------+------------------------------------------------------
According to [http://codex.wordpress.org/Creating_Options_Pages Codex],
one sets up
page_options with options to be updated.
This does not pass the check in options.php line 48:
{{{
if( !isset( $whitelist_options[ $option_page ] ) )
wp_die( __( 'Error! Options page not found.' ) );
if( $option_page == 'options' ) {
if( is_site_admin() ) {
$options = explode(',', stripslashes( $_POST[
'page_options' ] ));
} else {
die( 'Not admin' );
}
} else {
$options = $whitelist_options[ $option_page ];
}
}}}
As coded, page_options only applies to options.php, and $whitelist_options
must contain any page name to be used.
Either the code needs to be repaired, or Codex documentation needs to be
updated with four bits:
- Remove the section on page_options
- Revise the discussion of the nonce argument to say it should be called
mypage-verb-options (eg. mypage==name of my plugin).
- Talk about a requirement to add a filter that augments
$whitelist_options
- Talk about an input item needed, called option-page (to match the
whitelist_options value and the nonce value without the -options suffix)
i.e.
{{{
echo "<input name='option_page' value='myplugin-update' />";
if (function_exists('wp_nonce_field')) wp_nonce_field('myplugin-update-
options');
}}}
and code for the new whitelist_options filter
--
Ticket URL: <http://trac.wordpress.org/ticket/7277>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list