The MU forums have moved to WordPress.org

Wordpress MU 2.8 add_menu_page (5 posts)

  1. AndrewGerssen
    Member
    Posted 16 years ago #

    I have a question concerning the function add_menu_page(page_title, menu_title, access_level/capability, file, [function], [icon_url]); .

    Well it seems that the function doesn't work without the [function] parameter, which should be variable.

    When you just want to include a option page like :

    add_options_page('MyPlugin', 'MyPluginSettings', 10, 'wp-myplugin/myplugin-options.php') ;

    it returns the following link in the admin:

    http://mydomain.com/wp-admin/wp-myplugin/myplugin-options.php

    which should return:

    http://mydomain.com/wp-admin/options-general.php?page=wp-myplugin/myplugin-options.php

    Can you guys help me, there are a lot of plugins which use the method of including an option file rather than calling a function. Which simply means that I would/must re-program all plugins....

  2. SergeyBiryukov
    Member
    Posted 16 years ago #

    There is a misprint in /wp-admin/menu-header.php, line 134:

    if ( ( ('index.php' != $sub_item[2]) && ( file_exists(WP_PLUGIN_DIR . "/$menu_file") || file_exists( WPMU_PLUGIN_DIR . "/$menu_file") ) ) || ! empty($menu_hook) ) {

    It should be $sub_file instead of $menu_file:

    if ( ( ('index.php' != $sub_item[2]) && ( file_exists(WP_PLUGIN_DIR . "/$sub_file") || file_exists( WPMU_PLUGIN_DIR . "/$sub_file") ) ) || ! empty($menu_hook) ) {
  3. AndrewGerssen
    Member
    Posted 16 years ago #

    Thnx @SergeyBiryukov!

    Can I adjust the code without any consequences? And must/can we report this as a bug?

  4. SergeyBiryukov
    Member
    Posted 16 years ago #

  5. AndrewGerssen
    Member
    Posted 16 years ago #

    I added your fix and it seems to work! I want to thank you again, for your quick response!

About this Topic

  • Started 16 years ago by AndrewGerssen
  • Latest reply from AndrewGerssen