Skip to content

Commit 4f6178e

Browse files
committed
Initialize menus with menu_categories
If user add custom categories, it will fix an issue where Menu is not collapsed
1 parent dc2b5af commit 4f6178e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

templates/tibiacom/index.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,23 @@ function LoginstatusTextAction(source) {
115115
menu[0] = {};
116116
var unloadhelper = false;
117117

118+
<?php
119+
$menuInitStr = '';
120+
foreach ($config['menu_categories'] as $item) {
121+
if ($item['id'] !== 'shops' || setting('core.gifts_system')) {
122+
$menuInitStr .= $item['id'] . '=' . ($item['id'] === 'news' ? '1' : '0') . '&';
123+
}
124+
}
125+
?>
126+
118127
// load the menu and set the active submenu item by using the variable 'activeSubmenuItem'
119128
function LoadMenu()
120129
{
121130
document.getElementById("submenu_"+activeSubmenuItem).style.color = "white";
122131
document.getElementById("ActiveSubmenuItemIcon_"+activeSubmenuItem).style.visibility = "visible";
123132
menus = localStorage.getItem('menus');
124133
if(menus == null || menus.lastIndexOf("&") === -1) {
125-
menus = "news=1&account=0&community=0&library=0&forum=0<?php if (setting('core.gifts_system')) echo '&shops=0'; ?>&";
134+
menus = "<?= $menuInitStr ?>";
126135
}
127136
FillMenuArray();
128137
InitializeMenu();

0 commit comments

Comments
 (0)