• Plugins
  • Created On ,
  • Most Recent By Aaron,

Dashboard menu placement hides theme options

Hi. Since there were no menu items for the dashboard plugin, the only way to access it was via the dashboard, which I didn't like, so I downgraded back to the updates plugin. I just accidentally upgraded to the latest version of the dashboard plugin, and now there is a menu item for WPMU DEV. That's great, but now my theme's options menu is MIA. So I guess the theme's menu was hiding the WPMU menu? But now it is the other way around. The theme is Vantage by AppThemes http://www.appthemes.com/themes/vantage/
Before I downgrade back to the updates plugin once again, I thought I'd share this with you. I'll hold off on the downgrade until Friday, in case you need more info.

    3SixtyEvolve
    • 45
    • #2493

    Hi @dubya

    Thank you for sharing this information with us. Any chance that you can send us a screenshot of what it currently looks like when you have the WPMU DEV Dashboard active (hiding the Vantage menu)?

    I will in any case go ahead and ping our Developer on this one to see if he has a quick solution for this.

    Have a good day and talk soon again.

    Gina

    Paul

    @dubya, thanks for bringing this to our attention. I'm sad to say a little confused about what is hidden and what is not. Any chance you can provide a screenshot showing the wp-admin menu?

    Paul

    Or better provide access to your site so I can check out what is happening. One change in the recent version was to hide the Themes and Plugin sub menus under the WPMU DEV Dashboard section if you have DISALLOW_FILE_MODES defined in your wp-config.php But this should not effect the main WordPress Appearances > Theme page.

    You can sent access info to paul [at] incsub.com

    Thanks.

    dubya

    Hey guys.

    The 2 images are with and without the dashboard plugin.

    Thanks for looking into this.

    dubya

    @PaulM
    You should have received log-in info.
    Please be aware that this is a production site.

    Paul

    @dubya, Thanks. I'll take a look and get you sorted out. Have not received the login information yet. But give email a few minutes.

    P-

    dubya

    I sent it from the add user page... I'll manually send it now as well.

    dubya

    Done.
    I just moved this site from DreamHost to Liquid Web, the mail settings may not be setup yet.

    Paul

    @dubya, So logged into your site. I'm not seeing the WPMU DEV menu but I do see the Vantage menu just below the WordPress Dashboard menu. Thinking this might be a conflict between the plugin and the theme. Any chance you can sent me the theme as a zip file? Then I can debug locally under my own test environment.

    Paul

    And just to be clear the parent theme not your child theme.

    Paul

    @dubya, ok figured this out. So in the theme look for the file
    /vantage/framework/scb/AdminPage.php line 325-326. Here is the start of the function

    '
    function page_init() {
    extract( $this->args );

    if ( ! $toplevel ) {
    $this->pagehook = add_submenu_page( $parent, $page_title, $menu_title, $capability, $page_slug, array( $this, '_page_content_hook' ) );
    } else {
    $func = 'add_' . $toplevel . '_page';
    $this->pagehook = $func( $page_title, $menu_title, $capability, $page_slug, array( $this, '_page_content_hook' ), $icon_url, $position );
    }
    '

    Some some code explanations. The first part of the If checked a flag to see if they are building a submenu panel or top-level. If submenu as you can see they use the proper WordPress add_submenu_page(); function. So if I'm adding a new menu item to the Settings sections.

    If they are NOT adding a submenu then we go into the else part. Here they SHOULD be using the standard (and recommended) WordPress function add_menu_page(); which lets you add your own top-level menus. http://codex.wordpress.org/Function_Reference/add_menu_page But for some reason the theme developer is overriding this to insert their own menu.

    Compare this to the WPMU DEV Dashboard code in update-notifications.php line 999 where we are properly adding the top-level menu

    '
    $page = add_menu_page( __('WPMU DEV Dashboard', 'wpmudev'), __('WPMU DEV', 'wpmudev') . $count_output, 'manage_options', 'wpmudev', array( &$this, 'dashboard_output'), $this->plugin_url.'/includes/images/icon.png', 3 );
    '

    If you have any sway over the theme developers they try and recommend they do the proper way. But I can almost tell you they won't make a change. Most developers, plugin and theme who really want their code's top-level menu to be the second one just under the main Dashboard do all sort of crazy things to achieve that solutions. I've seen similar things done with the Dashboard panels. Everyone wants to be in the top position. Anyway, sorry this didn't come to a better solution.

    dubya

    Thanks Paul.
    You are awesome.

    I have shared your response with the theme's Devs. There may be other plugins out there with a similar conflict, so I suspect you are wrong about it getting fixed. Let's think positive ;-)

    Thanks again.

    dubya

    So apparently this is a WordPress bug. Here's the response from AppThemes:

    What the WPMU plugin does:

    $page = add_menu_page( __('WPMU DEV Dashboard', 'wpmudev'), __('WPMU DEV', 'wpmudev') . $count_output, 'manage_options', 'wpmudev', array( &$this, 'dashboard_output'), $this->plugin_url.'/includes/images/icon.png', 3 );

    What APP_Dashboard does:

    extract( wp_parse_args( $args, array(
        'page_slug' => 'app-dashboard',
        'toplevel' => 'menu',
        'position' => 3,
        'screen_icon' => 'themes',
    ) ) );
    
    $func = 'add_' . $toplevel . '_page';
    $this->pagehook = $func( $page_title, $menu_title, $capability, $page_slug, array( $this, '_page_content_hook' ), $icon_url, $position );

    So both use the existing API correctly, but because both pass $position = 3, one overwrites the other. This is a limitation in the admin menu API and I hope to get it fixed eventually in Core:

    http://core.trac.wordpress.org/ticket/12718

    Mason

    Wow. Some serious sleuthing happening there. Well done. Hope this one gets fixed up quickly!

    Alex
    • Bronze
    • 17
    • #6462

    I'm having the same issue with my theme, what is the easiest way of resolving this?