[wp-hackers] 1.5.1 ?
Kimmo Suominen
kim at tac.nyc.ny.us
Mon Mar 21 16:09:38 GMT 2005
On Mon, Mar 21, 2005 at 09:22:11AM -0500, Scott Merrill wrote:
> Specifically, bug 902 is pretty serious for us plugin authors.
Because of #902, you should not use the new hooks for adding pages. The
old way still works, although I've never needed to do more than one page
so YMMV.
This is the code structure I use:
if (is_plugin_page()):
$wppTimeZone->options_page();
else:
class TimeZone
{
function TimeZone()
{
add_action('admin_menu', array(&$this, 'admin_menu'));
// Broken in WordPress 1.5
//add_action('options_page_timezone', array(&$this, 'options_page'));
add_action('option_gmt_offset', array(&$this, 'option_gmt_offset'));
}
function admin_menu()
{
add_options_page(
__('Time Zone Options'),
__('Time Zone'), 5, basename(__FILE__));
}
function options_page()
{
[.. code for the options page ..]
}
[.. the rest of the code ..]
}
$wppTimeZone =& new TimeZone;
endif; // is_plugin_page()
Notice the commented out add_action() call.
Sometime after 1.5.1 is out, if I make a new release, I'll just remove
the "old way". (That's why the class is not indented inside the else.)
Regards,
+ Kim
--
<A HREF="http://kimmo.suominen.com/">Kimmo Suominen</A>
More information about the wp-hackers
mailing list