#5379 closed enhancement (fixed)
Add admin_menu_permission hook to menu.php
| Reported by: | donncha | Owned by: | westi |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.5 |
| Component: | General | Version: | 2.3.1 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
WordPress MU has a modified wp-admin/menu.php but with the addition of a new hook just above the user_can_access_admin_page() check, those custom mods can go into a new file.
I called the action admin_menu_permission as there are hooks above for modifying the admin menu, this hook wouldn't have any other function AFAICT.
I did try hooking on to admin_menu but it didn't work and the user received the standard WP "cannot access page" error instead of being redirected as WordPress MU usually does.
Please take a look at the attached file.
Attachments (1)
Change History (6)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Looking at the mu code (http://trac.mu.wordpress.org/browser/trunk/wp-admin/menu.php) would we not do better with an action inside the failure case:
e.g.
if (! user_can_access_admin_page()) { do_action('admin_page_access_denied'); wp_die( __('You do not have sufficient permissions to access this page.') ); }mu can then hook on that and do the redirect if necessary before the wp_die