Helping you Build Your Own Social Network!

Faster, better and easier!

enabling wordress adminbar

(17 posts) (3 voices)

Tags:

No tags yet.


  1. Hi Brajesh,

    I want to have a admin bar similar to buddypress.org, adding define('BP_USE_WP_ADMIN_BAR', true);

    does not help. I still see the same old buddybar. Am i missing something?

    Posted 8 months ago #
  2. Hi Gwu,
    Please put that in wp-config.php

    define('BP_USE_WP_ADMIN_BAR',true);

    Make sure it comes before this line

    require_once(ABSPATH . 'wp-settings.php');
    Posted 8 months ago #
  3. doing that has completely removed the admin/buddy bar.

    Posted 8 months ago #
  4. Hi GWu,
    are you sure you put it above the last line? I mean it should come before the last include statement.

    look for the comment like this

    /* That's all, stop editing! Happy blogging. */

    you can put the code to use admin bar just above/below that line.

    Posted 8 months ago #
  5. got it. I was not logged in. it is showing up for logged in users. thanks

    Posted 8 months ago #
  6. No problem. You are most welcome :)

    Posted 8 months ago #
  7. how can i customize the admin bar. earlier i had put code in bp-custom.php, where i removed all the menu buddybar action and put in my own. e.g i removed the multilevel navigation and just kept it single level.

    also i had put in the bp search (blogs, members, groups) inside my buddybar. Hw can i remove the adminbar search and put in bp search.

    which css file do i need to override?

    how can i do this customization with admin bar?

    Posted 8 months ago #
  8. Hi Brajesh,

    When I use buddybar, i did the above like this

    function my_alter_bp_adminbar(){
    remove_action('bp_adminbar_menus', 'bp_adminbar_account_menu', 4);
    add_action('bp_adminbar_menus', 'my_adminbar_account_menu', 50);
    }
    add_action('wp_footer','my_alter_bp_adminbar',1);

    How can I do the same with wp-admin bar.

    thanks

    Posted 7 months ago #
  9. any help? I would like to use the wp-adminbar and edit the bp menu in it.

    Also would like to replace the wp-search with bp-search.

    Thanks

    Posted 7 months ago #
  10. Hi Gwu,
    sorry I could not update on this topic. need some time to look at the adminbar code. will let you know late today or tomorrow.

    Posted 7 months ago #
  11. thanks brajesh.

    Posted 7 months ago #
  12. Hi gwu,

    This shouldn't be to difficult what your trying to achieve, Just depends how you use the code already provided in adminbar,
    I've done loads to mine, I had to delete the whole of the buddybar.css and re-write with my own to get me to display as i wanted, before 1.5 i just edited the custom.php to do this, But now i had to delete the wp-core-buddybar and create my own more of a pain but it does work, especially when you look inside bp-core-adminbar, add what you need from that or vice versa, It will work if you get it correctly, By the way look inside wp-includes for the adminbar.css if you need too, But i found all i needed in wp-includes/admin-bar.php & bp-core/bp-core-adminbar.php the main CSS you may need is in bp-core/css/ you'll have all adminbar & buddybar CSS there :) any php mods you need to do then do it in the originated files themselves so there is no conflict or white/blank pages :)

    Ben

    Posted 7 months ago #
  13. i want to do it without touching the core files

    Posted 7 months ago #
  14. Ok, It was only a suggestion.

    Posted 7 months ago #
  15. Hi Gwu,
    It is a slightly changed when using wordpress adminbar

    Here is a way to add some new menu item

    function add_my_menu(){
    global $wp_admin_bar;
    
    $wp_admin_bar->add_menu( array(
    		'id'    => 'my-menu-unique-id',
    		'title' => 'My Menu Title',
    		'href'  => 'http://mysite.com/somepagelinked'
    	) );
    
    //add some child item in this menu
    
    $wp_admin_bar->add_menu( array(
    				'id' => 'child-menu-id',
    				'parent' => 'my-menu-unique-id',
    				'title' => 'Child Menu',
    				'href' => 'http://mysite.com/chiledmenulink'
    			) );
    
    }
    //hook it
    add_action('init','add_my_menu',20);

    The above code should be hooked after init action(or if hooked to initi action must have priority lower than 10, e.g 11 or anything greater that that).

    Similarly, you can delete a menu item as this

    function delete_my_menu(){
    global $wp_admin_bar;
    
    $wp_admin_bar->remove_menu('menu_id');/yes you need to know them
    
    }
    //hook it
    add_action('wp_before_admin_bar_render','delete_my_menu');

    In case you don't want to add a menu and rather put the search form and so,

    you can hook to

    add_admin_bar_menus'

    Still, you can not remove the default search from of the adminbar using php as it is hardcoded into the render function and I don't see a way to do it using php. The best bet will be using css and set display:none

    Posted 7 months ago #
  16. since the above code will inject the menu as the first item, you can try following to reposition it.

    function add_my_menu($wp_admin_bar){
    
    $wp_admin_bar->add_menu( array(
    		'id'    => 'my-menu-unique-id',
    		'title' => 'My Menu Title',
    		'href'  => 'http://mysite.com/somepagelinked'
    	) );
    
    //add some child item in this menu
    
    $wp_admin_bar->add_menu( array(
    				'id' => 'child-menu-id',
    				'parent' => 'my-menu-unique-id',
    				'title' => 'Child Menu',
    				'href' => 'http://mysite.com/chiledmenulink'
    			) );
    
    }
    //hook it
    add_action('admin_bar_menu','add_my_menu',100);

    It's all about playing with the priorities.

    Posted 7 months ago #
  17. thanks Brajesh. Editing wp-admin bar is not as flexible as editing buddy bar, I will go back to using buddy bar.

    thanks.

    Posted 7 months ago #

Reply

You must log in to post.