[wp-hackers] Proposal: Adding a filter to get_admin_page_parent()

Callum Macdonald lists.automattic.com at callum-macdonald.com
Wed Oct 31 17:50:47 GMT 2007


G'day,

I'm hacking a version of WPMU to customise the admin interface. I've 
stripped out some of the menus that we don't want users to access 
(Themes and Users for example). I can remove the menus via the 
admin_menu action, however, it screws the sub menus.

menu-header.php[1] calls get_admin_page_parent() to figure out what the 
current page's parent is. The parents are hard coded into the individual 
admin pages, and as far as I can see, there's no way to override them 
via the plugin API.

wp_admin_page_parent[2] currently has 7 return()s. So the simplest 
approach might be to wrap it in a wrapper function and apply the filter. 
Something like:
function get_admin_page_parent() {
    $return = _get_admin_page_parent();
    apply_filter('get_admin_page_parent',$return);
}

Anyone got any suggestions? I'll whip up a trac ticket and patch in due 
course, but wanted to float the idea here first in case I've missed 
something.

Cheers - Callum.

[1] http://trac.wordpress.org/browser/trunk/wp-admin/menu-header.php#L6
[2] 
http://trac.wordpress.org/browser/trunk/wp-admin/includes/plugin.php#L213



More information about the wp-hackers mailing list