[wp-hackers] Change in plugin Options page handling

Owen Winkler ringmaster at midnightcircus.com
Tue Feb 22 20:40:32 GMT 2005


Ryan Boren wrote:
> We need to add the hook support to add_menu_page() and make sure
> add_menu_page() followed by an add_submenu_page() build a proper
> hierarchy.  Want to take a crack at it?  I can't look at it right now.

Well, after a couple hours of tinkering, this just ain't gonna happen 
with the current code.

The primary reason is that the submenus use this format for their URL:

/wp-admin/parent_page.php?page=plugin_page.php

If a plugin supplies more than one tab for a single main menu, there is 
no way to determine which one to display.  This is very likely in the 
case that a plugin supplies its own top-level menu.

Similarly, adding a new top-level menu page with add_menu_page() in the 
style of add_submenu_page() - where the content of the page is output 
from a plugin hook sink function - would require some stub file to 
display the menu.  Why?  You can't pass the plugin filename as both the 
parnet_page and the plugin_page in the URL above because that would 
redeclare all of the plugin functions.  (I'm trying to avoid 
is_plugin_page() as per the mosquito discussion on this topic.)

Maybe there's a simple solution that I'm not seeing, and I'm sorry if 
I'm blind to it, but it seems to me that the menu system is going to 
need a greater overhaul than a few tweaks.

I'm still thinking about it, though...

Owen




More information about the hackers mailing list