title = __("Admin bar", "dagsopt"); $this->pluginname = $ns->pluginname; $this->file = $ns->file; $this->ns = $ns; } function start() { add_action('admin_bar_menu', array(&$this, 'bu_admin_link_first'), 1); add_action('admin_bar_menu', array(&$this, 'bu_admin_link_last'), 200); if (get_option($this->pluginname . "_admin_bar" . '_remove_comments', false)) { add_action('wp_before_admin_bar_render', array(&$this, 'bu_admin_link_remove_comments'), 210); } if (!function_exists('wp_get_current_user')) { include ABSPATH . "wp-includes/pluggable.php"; } // remove_submenu_page('index.php','update-core.php'); $current_user = wp_get_current_user(); if (current_user_can('manage_options') && $current_user->user_login == "admin") { add_action('admin_menu', array(&$this, 'setup_menus'), 220); } else { add_action('admin_menu', array(&$this, 'remove_menus'), 220); add_action('wp_before_admin_bar_render', array(&$this, 'remove_menus2'), 210); } } function remove_menus2() { global $wp_admin_bar; if (get_option($this->pluginname . "_admin_bar" . '_remove_new-post', false)) { $wp_admin_bar->remove_menu("new-post"); } if (get_option($this->pluginname . "_admin_bar" . '_remove_new-link', false)) { $wp_admin_bar->remove_menu("new-link"); } if (get_option($this->pluginname . "_admin_bar" . '_remove_new-page', false)) { $wp_admin_bar->remove_menu("new-page"); } if (get_option($this->pluginname . "_admin_bar" . '_remove_new-media', false)) { $wp_admin_bar->remove_menu("new-media"); } if (get_option($this->pluginname . "_admin_bar" . '_remove_new-user', false)) { $wp_admin_bar->remove_menu("new-user"); } } function setup_menus() { global $menu; $this->gmenu = $menu; } function remove_menus() { global $menu; /* $this->setup_menus(); $rr = array(); foreach($this->gmenu as $id => $mm){ if(get_option($this->pluginname."_admin_bar".'_remove_'.$mm[5],false)){ array_push($rr,$mm[5]); } } foreach($menu as $id => $menupoint){ if(isset($menupoint[5]) && in_array($menupoint[5],$rr)){ unset($menu[$id]); } } remove_submenu_page('index.php','update-core.php'); remove_submenu_page('themes.php','update'); remove_submenu_page('themes.php','checkupdate'); remove_submenu_page('themes.php','custom-header'); remove_submenu_page('themes.php','custom-background'); remove_submenu_page('themes.php','theme-editor.php'); remove_submenu_page('themes.php','themes.php'); //add_submenu_page( 'themes.php', "Customize", "Customize", "", "customize.php", ""); */ } function bu_admin_link_first() { global $wp_admin_bar; if (get_option($this->pluginname . "_admin_bar" . '_dags_logo', true)) { $wp_admin_bar->add_menu(array('id' => 'dags-logo', 'title' => '', 'href' => 'https://dags.dk/', 'meta' => array('title' => __('Dags dk', 'dagsopt')))); } } function bu_admin_link_remove_comments() { global $wp_admin_bar; $wp_admin_bar->remove_menu('comments'); } function bu_admin_link_last() { global $wp_admin_bar; if (get_option($this->pluginname . "_admin_bar" . '_dags_logo', true)) { $wp_admin_bar->remove_node("wp-logo"); } if (get_option($this->pluginname . "_admin_bar" . '_show_ip', true)) { $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'IP', 'title' => 'IP: ' . $_SERVER['SERVER_ADDR'], 'href' => admin_url('admin.php?page=' . $this->pluginname . '-options'))); } if (current_user_can('manage_options') && get_option($this->pluginname . "_admin_bar_live_url")) { if (get_option($this->pluginname . "_admin_bar" . '_show_switcher', true)) { if ($_SERVER['HTTP_HOST'] == get_option($this->pluginname . "_admin_bar_live_url")) { $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'DEV_live', 'title' => get_option($this->pluginname . "_admin_bar_live_title"), 'href' => get_option($this->pluginname . "_admin_bar_live_url") . $_SERVER['REQUEST_URI'], 'meta' => array('class' => 'active'))); $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'DEV_stage', 'title' => get_option($this->pluginname . "_admin_bar_stage_title"), 'href' => get_option($this->pluginname . "_admin_bar_stage_url") . $_SERVER['REQUEST_URI'], 'meta' => array('class' => ''))); $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'DEV_local', 'title' => get_option($this->pluginname . "_admin_bar_local_title"), 'href' => get_option($this->pluginname . "_admin_bar_local_url") . $_SERVER['REQUEST_URI'], 'meta' => array('class' => ''))); } else if ($_SERVER['HTTP_HOST'] == get_option($this->pluginname . "_admin_bar_stage_url")) { $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'DEV_live', 'title' => get_option($this->pluginname . "_admin_bar_live_title"), 'href' => get_option($this->pluginname . "_admin_bar_live_url") . $_SERVER['REQUEST_URI'], 'meta' => array('class' => ''))); $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'DEV_stage', 'title' => get_option($this->pluginname . "_admin_bar_stage_title"), 'href' => get_option($this->pluginname . "_admin_bar_stage_url") . $_SERVER['REQUEST_URI'], 'meta' => array('class' => 'active'))); $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'DEV_local', 'title' => get_option($this->pluginname . "_admin_bar_local_title"), 'href' => get_option($this->pluginname . "_admin_bar_local_url") . $_SERVER['REQUEST_URI'], 'meta' => array('class' => ''))); } else { $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'DEV_live', 'title' => get_option($this->pluginname . "_admin_bar_live_title"), 'href' => get_option($this->pluginname . "_admin_bar_live_url") . $_SERVER['REQUEST_URI'], 'meta' => array('class' => ''))); $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'DEV_stage', 'title' => get_option($this->pluginname . "_admin_bar_stage_title"), 'href' => get_option($this->pluginname . "_admin_bar_stage_url") . $_SERVER['REQUEST_URI'], 'meta' => array('class' => ''))); $wp_admin_bar->add_menu(array('parent' => 'top-secondary', 'id' => 'DEV_local', 'title' => get_option($this->pluginname . "_admin_bar_local_title"), 'href' => get_option($this->pluginname . "_admin_bar_local_url") . $_SERVER['REQUEST_URI'], 'meta' => array('class' => 'active'))); } } } else { } } function help() { ?> stage > live", "dagsopt")) ?>


gmenu as $id => $mm) { update_option($pre . '_remove_' . $mm[5], $_POST[$pre . '_remove_' . $mm[5]]); } } function admin_line($pre) { ?>
/>
/>
/>
Remove Menus
gmenu as $id => $mm) { if (strstr($mm[2], "separator")) { continue; } ?>
dagsopt['plug_admin_bar'] = $plug_admin_bar; }