Hello all,
I've just discovered what I think to be a bug when using the add_menu_page and the add_submenu_page function within a MU plugin.
When a plugin adds a menu page with add_menu_page, the system has to create in the menu header a link which goes to ".../wp-admin/admin.php?page=plugin_file". It works well with "normal" plugins but it doesn't work with MU plugins, instead of this URL we have ".../wp-admin/plugin_file" (and this link creates an error of course).
I had the problem while making WP-Poll a MU plugin.
Here is a diff to fix this bug (if it is really a bug?):
17c17,19
< if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
---
> //if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
> // Fix by Frederic Feytons for MU plugins (1 of 3)
> if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || file_exists(ABSPATH . "wp-content/mu-plugins/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
22c24,26
< if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
---
> //if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
> // Fix by Frederic Feytons for MU plugins (2 of 3)
> if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || file_exists(ABSPATH . "wp-content/mu-plugins/{$item[2]}") )
50c54,56
< if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || ! empty($menu_hook)) {
---
> //if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || ! empty($menu_hook)) {
> // Fix by Frederic Feytons for MU plugins (3 of 3)
> if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || file_exists(ABSPATH . "wp-content/mu-plugins/{$item[2]}") || ! empty($menu_hook)) {
Hope this help :-)
Frederic.