[wp-trac] Re: [WordPress Trac] #7277: page_options doesn't work for plugin pages

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 29 12:34:44 GMT 2008


#7277: page_options doesn't work for plugin pages
---------------------+------------------------------------------------------
 Reporter:  Mr Pete  |        Owner:  anonymous
     Type:  defect   |       Status:  reopened 
 Priority:  normal   |    Milestone:           
Component:  General  |      Version:           
 Severity:  normal   |   Resolution:           
 Keywords:           |  
---------------------+------------------------------------------------------
Comment (by Mr Pete):

 Sigh. The code I posted on 07/21/08 needed testing in more environments.

 Here's a better sample. NOTE: it's not clear to me what the best test is
 for the new security system. I'm checking for presence of a function that
 appears related. In any case, you can't normally test for presence of
 $whitelist_options in a plugin!

 {{{
 add_filter('whitelist_options', 'myplug_validOptions'); // Add filter
 globally
 function myplug_validOptions() {
   global $whitelist_options;
   $whitelist_options['myplug-update'] = array(
 'myplug_opt1','myplug_opt2');
 }

 if (function_exists('add_option_whitelist')) {
   echo '<input name="option_page"  value="myplug-update"
 type="hidden" />';
   wp_nonce_field('myplug-update-options');
 } else {
   echo '<input name="option_page"  value="update"
 type="hidden" />';
   echo '<input name="page_options" value="myplug_opt1,myplug_opt2"
 type="hidden" />';
   if (function_exists('wp_nonce_field')) wp_nonce_field('update-options');
 }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7277#comment:8>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list