The MU forums have moved to WordPress.org

Bug with add_menu_page and MU plugins (8 posts)

  1. dreamer12345
    Member
    Posted 17 years ago #

    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.

  2. dreamer12345
    Member
    Posted 17 years ago #

    Oh I forgot to say that this fix concerns the wp-admin/menu-header.php file :-)

  3. drmike
    Member
    Posted 17 years ago #

    Please open up at ticket on the trac:

    http://trac.mu.wordpress.org

    thanks,
    -drmike

  4. dreamer12345
    Member
    Posted 17 years ago #

    Ok, I'll do it ;-)

  5. drmike
    Member
    Posted 17 years ago #

    Thanks.

  6. apeatling
    Member
    Posted 17 years ago #

    I just spent all evening running into this bug over and over. I updated WPMU with the code above and things are now working.

    What's the fix status on this, was there ever a ticket opened? This bug is still present in version 1.2.3

    Cheers,
    Andy

  7. lunabyte
    Member
    Posted 17 years ago #

  8. apeatling
    Member
    Posted 17 years ago #

    I've added a bug report in trac for this, cheers.

About this Topic

  • Started 17 years ago by dreamer12345
  • Latest reply from apeatling