MyBB Community Forums

Full Version: Admin Theme Issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm making a new admin theme and I'm running into some trouble generating the submenus. This is my function to do so:

    function _build_menu()
    {
        if( !is_array($this->_menu) )
        {
            return false;
        }
        
        $menu = '<div id="sidebar">'."\n".'    <ul>'."\n";
        ksort($this->_menu);
        foreach( $this->_menu as $items )
        {
            foreach( $items as $item )
            {
                $item['link'] = htmlspecialchars($item['link']);
                if( $item['id'] == $this->active_module )
                {
                    $submenu = $item['submenu'];
                    $submenu_title = $item['title'];
                    // Build submenu
                    $this->_build_submenu($submenu_title, $submenu);
                    $menu .= '<li class="active">'."\n".'            ';
                    $menu .= '<a href="'.$item['link'].'">'.$item['title'].'</a>'."\n".'            ';
                    $menu .= $this->submenu."\n".'        </li>'."\n".'        ';
                }
                else
                {
                    $menu .= '<li><a href="'.$item['link'].'">'.$item['title'].'</a></li>'."\n".'        ';
                }
            }
        }
        $menu .= '    </ul>'."\n".'</div>'."\n";
        return $menu;
    }

The submenus are integrated into the main "tabs" (it's a funky theme compared to the default). I'm only getting the first submenu to show up. If I'm on the main page, only "Home" (Dashboard, Preferences, Version Check, MyBB Credits) is displayed, not all three (Home, Quick Access, Online Admins).

As far as I can tell my function is no different from the original other than when the submenu is generated. Can someone with experience with this help me out? Thanks!