Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP admin bar on bbpress front page


  • Erwin Gerrits
    Participant

    @egerrits

    Hi,

    I am trying to make the bbpress front page to look like my buddypress page so it looks a bit more integrated, and I can add a tab “forums” to the main navigation which will bring me from wordpress mu font page to bbpress front page.

    For this, I need to display the buddypress admin bar on top of the bbpress front page. Is this a possibility? Do I need to load the entire wordpress header? (is this even possible from a sub directory?)

    Thanks for your help

Viewing 25 replies - 1 through 25 (of 25 total)

  • Kevin Ryman
    Participant

    @kevinryman

    I also would like to know this. Any tips? Thanks in advance!


    terryjsmith
    Participant

    @terryjsmith

    I have hacked together a solution for this. I hope to release a bbPress plug-in in the coming week :)

    I’ll post a link here when it’s done.


    Kevin Ryman
    Participant

    @kevinryman

    @terryjsmith

    Hope to hear news about this soon! Thanks!


    Erwin Gerrits
    Participant

    @egerrits

    Sounds great, thanks!


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    I just wish I knew how to get bbPress to stop wiping out all the BuddyPress/WPMU filters and hooks. Incorporating them together is so easy, but making them play nice together isn’t… :/


    terryjsmith
    Participant

    @terryjsmith

    @johnjamesjacoby I know what you mean. If you really want to hack it, here are the directions:

    1. Comment out this, in bp-core/bp-core-adminbar.php, line 14:

    do_action( ‘bp-adminbar-logo’ );

    2. Add this on the following line:

    bp_adminbar_logo();

    3. Comment out this, in bp-core/bp-core-adminbar.php, line 19:

    do_action( ‘bp-adminbar-menus’ );

    4. Add underneath it:

    bp_adminbar_login_menu();

    bp_adminbar_account_menu();

    bp_adminbar_blogs_menu();

    bp_adminbar_notifications_menu();

    bp_adminbar_authors_menu();

    bp_adminbar_random_menu();

    5. Add the following scripts to your template’s header.php file:

    mu-plugins/bp-core/js/jquery/jquery.livequery.pack.js?ver=2.7

    mu-plugins/bp-core/js/general.js?ver=2.7

    mu-plugins/bp-core/bp-core-ajax-handler.php

    mu-plugins/bp-core/css/admin-bar.css?ver=2.7

    6. Finally, add the following to your template’s footer.php:

    include(‘../../../wp-content/mu-plugins/bp-core/bp-core-adminbar.php’);

    bp_core_admin_bar();

    7. If you’re not already, include wp-blog-header.php into bb-config.php:

    require_once(‘../wp-blog-header.php’);

    Note: I do not recommend this solution as upgrades, patches, etc. will break this functionality.

    With that in mind, I’ll be releasing a much sexier solution in the form of a plugin soon as stated above.

    Hope this helps,

    Terry


    fishbowl81
    Participant

    @fishbowl81

    I have spent a long time and created a general forums plugin. I will not be releasing it, as it requires additional modifications to the core of buddypress, but you cen see it working at:

    http://gorgeousgamers.com/beta/forums

    There is a modification request which I submitted, to remove the error in the core, but I don’t believe it has been resolved yet.

    Brad


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    @terry, thanks that actually worked perfectly, and it also cleared up another problem I was having too.. I was still including wp-load.php instead of the header only. This is a perfect work around until a plugin is made.

    Much obliged!


    r-a-y
    Keymaster

    @r-a-y

    Perfect thread! Was looking for instructions to integrate the BP Core Admin Bar into bbPress.

    I did something a little bit different.

    Instead of hacking the core files, I used my bbPress theme’s functions.php file and added the functions listed in step #4 into a customized function I called “recreate_bb_admin_bar”.

    Then I added this function as an “add_action” and it works!

    *Make sure you have step #7 done as well.

    Thanks guys!


    Arturo
    Participant

    @arturo84

    r-a-y is possible have what you’ve in functions.php of your bbpress theme and what in “add_action” in header.php or footer.php?

    thanks!


    r-a-y
    Keymaster

    @r-a-y

    I sent this to Arturo, but I thought I’d post it on the forums as well!

    Here’s my complete bbPress functions.php code so far:

    function recreate_bb_admin_bar() {
    echo '<div id="wp-admin-bar"><ul class="main-nav">';
    bp_adminbar_logo();
    bp_adminbar_login_menu();
    bp_adminbar_account_menu();
    bp_adminbar_blogs_menu();
    bp_adminbar_notifications_menu();
    bp_adminbar_authors_menu();
    bp_adminbar_random_menu();
    echo '</ul></div>';

    }

    add_action( 'wp_footer', 'recreate_bb_admin_bar', 8 );
    add_action( 'admin_footer', 'recreate_bb_admin_bar' );
    add_action( 'wp_head', 'bp_core_admin_bar_css', 1 );

    Have fun!


    suleiman
    Participant

    @suleiman

    I use the filter my_admin_bar_logo($content){

    return “/custom-img/admin_bar_logo.gif”;

    }

    to replace the admin image in the top left hand corner of the buddybar with a custom one r-a-y.

    If I use the code you provided then my custom image isn’t shown, and the formatting that shows up is positioned too far to the right.

    Any idea why this might be happening?


    suleiman
    Participant

    @suleiman

    I was able to fix the problem of the wrong logo by adding in the following line to my bbpress functions.php file:

    add_filter(‘bp_admin_bar_logo_src’, ‘my_admin_bar_logo’);

    The new problem is that the logo still appears with too big of a left margin. Any ideas folks?


    r-a-y
    Keymaster

    @r-a-y

    It’s a CSS issue, suleiman.

    You’ll need to either modify the bp core admin bar CSS or add a CSS rule to your bbPress theme’s CSS file


    suleiman
    Participant

    @suleiman

    Yeah, I’m playing around with doing that now. Just was wondering if anyone else out there was experiencing the same.


    mattlay
    Participant

    @mattlay

    @Terryjsmith what is the status of your ‘sexy’ plugin to do this?

    I am curious if anyone knows if bbpress and BP are working to do this somehow by default. I am sure they are working on a lot of things but like I said this seems rather important from a users perspective.


    Jeff Sayre
    Participant

    @jeffsayre

    @Mattlay-

    As he has not been active on these forums for over a month, I doubt you’ll get a reply from Terryjsmith.

    But, to answer this question:

    I am curious if anyone knows if bbpress and BP are working to do this somehow by default. I am sure they are working on a lot of things but like I said this seems rather important from a users perspective.

    You should view theBuddyPress roadmap. You can see that for BP v1.1, better integration support is one of the goals.


    seppolaatle112
    Participant

    @seppolaatle112

    I am using Buddypress 1.01 width Wpmu 2.7.1 and managed to get the adminbar working great without even touching Buddypress core.

    All i actually did was to make sure I had :

    require_once('../wp-blog-header.php');

    in my bb-config.php-file, and after that i just simply added r-a-y’s code to my bb-theme functions.php file. :

    function recreate_bb_admin_bar() {

    echo '<div id="wp-admin-bar"><ul class="main-nav">';

    bp_adminbar_logo();

    bp_adminbar_login_menu();

    bp_adminbar_account_menu();

    bp_adminbar_blogs_menu();

    bp_adminbar_notifications_menu();

    bp_adminbar_authors_menu();

    bp_adminbar_random_menu();

    echo '</div>';

    }

    add_action( 'wp_footer', 'recreate_bb_admin_bar', 8 );

    add_action( 'admin_footer', 'recreate_bb_admin_bar' );

    add_action( 'wp_head', 'bp_core_admin_bar_css', 1 );

    Works just perfect. I can’t really see any need for a plugin to do this, but I guess there’s always someone who don’t manage without them. :)


    seppolaatle112
    Participant

    @seppolaatle112

    Ok, I’m getting tired of this forum always changing my posts when submitting. I guess that post up there is good enough for you guys to understand. :)


    r-a-y
    Keymaster

    @r-a-y

    Okay everyone!

    Here’s an update to my code for the BP admin bar in bbPress.

    Keep the existing recreate_bb_admin_bar() function, but for the last part (the add_action’s) use this:

    add_action('bb_foot', 'recreate_bb_admin_bar');
    add_action('bb_admin_footer', 'recreate_bb_admin_bar');
    add_action( 'bb_head', 'bp_core_admin_bar_css', 1 );
    add_action( 'bb_admin_head', 'bp_core_admin_bar_css', 1 );

    This uses bbPress’ default header and footer hooks instead of WordPress’, so in theory, you could get rid of wp_head and wp_footer in your bbPress theme.

    You’ll still need to keep the deep integration code in your bb-config.php though!

    Also this code is updated so you can see the BP admin bar in the bbPress admin area. The code before did not work for that!


    necati
    Participant

    @necati

    The above works for me too on the front page. But as soon as I try to go to admin pages it spits out errors, not able to find the wp-blog-header file.

    I am by no means a coder but it worked when I changed the bb-config.php add to:

    require_once($_SERVER['DOCUMENT_ROOT'].'/wp-blog-header.php');

    In case someone else faces the same problem…

    Hi r-a-y,

    What do U mean by keeping “deep integration” ? Do I need to add step #7 of Terryjsmith post, and then do your magic with bbPress theme’s functions.php ?


    r-a-y
    Keymaster

    @r-a-y

    @el_terko:

    Sorry for not being clear!

    What I mean by “deep integration” is calling WordPress into bbPress. You can do this by doing what Necati above you said. Then you can just follow the steps I have listed above.

    @Necati:

    Thanks for posting that for everyone! My instructions weren’t the clearest!

    [EDIT]

    I decided to post the full code again for clarity’s sake.

    On line 2 in bb-config.php (located in your bbPress forum install), add this:

    require_once($_SERVER['DOCUMENT_ROOT'].'/wp-blog-header.php');

    Now, add this to your bbPress theme’s functions.php (if you do not have a functions.php file in your bbPress theme folder, create one!)

    function recreate_bb_admin_bar() {
    echo '<div id="wp-admin-bar">';
    bp_adminbar_logo();
    echo '<ul class="main-nav">';
    bp_adminbar_login_menu();
    bp_adminbar_account_menu();
    bp_adminbar_blogs_menu();
    bp_adminbar_notifications_menu();
    bp_adminbar_authors_menu();
    bp_adminbar_random_menu();
    echo '</ul></div>';
    }
    add_action('bb_foot', 'recreate_bb_admin_bar');
    add_action('bb_admin_footer', 'recreate_bb_admin_bar');
    add_action( 'bb_head', 'bp_core_admin_bar_css', 1 );
    add_action( 'bb_admin_head', 'bp_core_admin_bar_css', 1 );

    I also made one last change to the function because it wasn’t XHTML validating before! See if you can spot the change ;)


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    r-a-y, I took the liberty of making this into a plugin for everyone. It’s a variant of what I’m using on the delsolownersclub.com site that I cleaned up for general usage.

    https://buddypress.org/forums/topic/buddybar-for-bbpress


    rockyteng
    Participant

    @rockyteng

    hi,ray,thanks a lot for your solution about this issue,it works pretty well.
    i have a question about your code.
    what does this line do?
    add_action( ‘bb_head’, ‘bp_core_admin_bar_css’, 1 );
    I suppose it was used to modify style.css file
    but i could not find where bp_core_admin_bar_css locate.
    could you explain it a little bit more?
    thanks again.

Viewing 25 replies - 1 through 25 (of 25 total)
  • The topic ‘BP admin bar on bbpress front page’ is closed to new replies.
Skip to toolbar