From 2ebd60821dd24c96d136942f299f5f3441519905 Mon Sep 17 00:00:00 2001 From: lonalore Date: Mon, 7 Nov 2016 16:01:12 +0100 Subject: [PATCH 1/2] Fix for Dashboard infopanel-menus. --- e107_admin/includes/infopanel.php | 50 +++++++++++++++++++------------ 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php index 3d8d26050..7bcc63bf3 100644 --- a/e107_admin/includes/infopanel.php +++ b/e107_admin/includes/infopanel.php @@ -57,12 +57,9 @@ class adminstyle_infopanel { $user_pref['core-infopanel-mye107'] = $_POST['e-mye107']; - + $user_pref['core-infopanel-menus'] = $_POST['e-mymenus']; + save_prefs('user'); - - $pref['core-infopanel-menus'] = $_POST['e-mymenus']; - - save_prefs(); } @@ -251,16 +248,24 @@ class adminstyle_infopanel // $text2 .= $ns->tablerender('Visitors Online : '.vartrue($nOnline), $panelOnline,'core-infopanel_online',true); // --------------------- User Selected Menus ------------------- - - - if (varset($pref['core-infopanel-menus'])) + + + if(varset($user_pref['core-infopanel-menus'])) { - foreach ($pref['core-infopanel-menus'] as $val) + foreach($user_pref['core-infopanel-menus'] as $val) { - $id = $frm->name2id('core-infopanel_'.$val); - $inc = $tp->parseTemplate("{PLUGIN=$val|TRUE}"); + // Custom menu (core). + if(is_numeric($val)) + { + $inc = e107::getMenu()->renderMenu($val, null, null, true); + } + // Plugin defined menu. + else + { + $inc = $tp->parseTemplate("{PLUGIN=$val|TRUE}"); + } + $text .= $inc; - // $text .= $ns->tablerender("", $inc, $id,true); } } @@ -675,15 +680,22 @@ class adminstyle_infopanel { while ($row = e107::getDb()->db_Fetch()) { - // if(!is_numeric($row['menu_path'])) + // Custom menu (core). + if(is_numeric($row['menu_path'])) { - $label = str_replace("_menu","",$row['menu_name']); - $path_to_menu = $row['menu_path'].$row['menu_name']; - $checked = ($settings && in_array($path_to_menu, $settings)) ? true : false; - $text .= "\n
"; - $text .= $frm->checkbox_label($label, "e-mymenus[]",$path_to_menu, $checked); - $text .= "
"; + $path_to_menu = $row['menu_path']; } + // Plugin defined menu. + else + { + $path_to_menu = $row['menu_path'].$row['menu_name']; + } + + $label = str_replace("_menu","",$row['menu_name']); + $checked = ($settings && in_array($path_to_menu, $settings)) ? true : false; + $text .= "\n
"; + $text .= $frm->checkbox_label($label, "e-mymenus[]",$path_to_menu, $checked); + $text .= "
"; } } From ca61dc9ef2858f3caba8c496ddb7ca9b8aac7f1e Mon Sep 17 00:00:00 2001 From: lonalore Date: Mon, 7 Nov 2016 16:10:05 +0100 Subject: [PATCH 2/2] Fix for Dashboard infopanel-menus. --- e107_admin/includes/infopanel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php index 7bcc63bf3..234ad002d 100644 --- a/e107_admin/includes/infopanel.php +++ b/e107_admin/includes/infopanel.php @@ -669,12 +669,12 @@ class adminstyle_infopanel } $frm = e107::getForm(); - $pref = e107::getPref(); + global $user_pref; $text = "
"; $menu_qry = 'SELECT * FROM #menus WHERE menu_id!= 0 GROUP BY menu_name ORDER BY menu_name'; - $settings = varset($pref['core-infopanel-menus'],array()); + $settings = varset($user_pref['core-infopanel-menus'],array()); if (e107::getDb()->gen($menu_qry)) {