[Bb-trac] Re: [bbPress] #623: Need a hook to extend the admin menu
bbPress
bb-trac at lists.bbpress.org
Sun Apr 1 14:24:59 GMT 2007
#623: Need a hook to extend the admin menu
-------------------------+--------------------------------------------------
Reporter: Null | Owner: sambauers
Type: enhancement | Status: new
Priority: normal | Milestone: 1.0
Component: integration | Version: 0.8.1
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+--------------------------------------------------
Comment (by sambauers):
Replying to [comment:11 so1o]:
> how about using [http://us3.php.net/manual/en/function.create-
function.php Create Function] to create the myplugin_add_admin_page
function and add the hook to bb_admin_menu_generator inside
bb_admin_add_menu. that way the user just has to call bb_admin_add_menu()
thats it..
I tried this and it didn't work. I would have to place the re-written
functions in a different location than bb-admin/admin-functions.php, which
seems messy. admin-functions.php isn't included until ''after'' the plugin
is loaded, so functions in admin-functions.php are not available directly
to plugins (only via hooks).
Also, I think create_function is inelegant, but that's just my opinion. It
also leaves garbage lying around in memory apparently.
add_action() is a standard API call that plugin developers should
understand.
> also can you see if we can add the position of the menu item as the
parameter to the function.
I actually don't think this is a good idea. We don't want to overwrite
core menu items. Anyone who wants to inject their plugin before the core
ones should have a very good reason to do so and they should be made to
work out how to do it themselves. It may not be flexible, but it will stop
casual accidents from occurring. People wanting to force their menu items
to the front of the plugin originated menus can use the "priority"
argument in add_action to do so.
All that being said, this function doesn't really do much except guard
against future core changes affecting plugins. So if we want all the extra
stuff you mentioned we'll have to rethink this. But the reason for this
ticket has been addressed I think.
--
Ticket URL: <http://trac.bbpress.org/ticket/623#comment:12>
bbPress <http://bbpress.org/>
Innovative forum development
More information about the Bb-trac
mailing list