Support » Plugin: WordPress Admin Bar » [Plugin: WordPress Admin Bar] front-end/back-end menu inconsistency

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Alex Mills (Viper007Bond)


    How are you adding the menu item? Can you paste that part of your plugin?

    add_action('admin_menu', 'create_my_sites_menu',1);
    function create_my_sites_menu() {
    global $current_user;

    $user_blogs = get_blogs_of_user($current_user->ID,true);

    add_menu_page( 'My Sites', "My Sites <span class='update-plugins'><span class='pending-count'>".count($user_blogs)."</span></span>", 'unfiltered_html', 'list-my-sites', 'my_sites');

    foreach($user_blogs as $k=>$blog) {
    add_submenu_page( 'list-my-sites', $blog->blogname, substr($blog->blogname,0,15), 'unfiltered_html', 'siteid-'.$k, 'nothin');

    function my_sites() {echo '';}
    function nothin() {echo '';}


    function change_links() {

    global $submenu,$menu;
    $mysites = $menu['100'];
    $mysites['4'] = str_replace('menu-top-first','',$mysites['4']);
    $menu['1'] = $mysites;
    $menu['1.5'] = array('','read','separator-last','','wp-menu-separator-last');
    $submenu['list-my-sites']['0']['2'] = 'my-sites.php';

    foreach($submenu['list-my-sites'] as $site=>$info) {
    if ($site == '0') continue;
    $id = str_replace('siteid-','',$submenu['list-my-sites'][$site]['2']);
    $site_details = get_blogaddress_by_id($id);
    $submenu['list-my-sites'][$site]['2'] = $site_details.'wp-admin/';


    After staring at it for awhile, it occurred to me that it’s probably related to the admin_menu hook since that’s not run on the front end – I just haven’t had a chance to test that yet…

    Plugin Author Alex Mills (Viper007Bond)


    It could be that or it could be due to the manual $menu/$submenu manipulation. I’m not sure.

    I wouldn’t spend much time on this though as the mutli-site compatible admin bar from is already into the WordPress 3.1 alpha and it’s a lot, lot better than my plugin. My plugin is being discontinued and will receive no further updates.

    yeah… definitely looking forward to the 3.1 admin bar – just looking for something to help me out until it has a stable release.

    thanks for taking a look

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WordPress Admin Bar] front-end/back-end menu inconsistency’ is closed to new replies.