Forum Replies Created
-
Thanks 21cdb, the magical “plugins_loaded” is what I need to know!
—
About your problem, maybe try using the boolean $doing_admin_bar that you’re using and use and if-else statement to call the custom CSS only when it is true in your my_admin_bar_css() function?
Jfcarter, this thread helped me:
https://buddypress.org/forums/topic.php?id=1152
I have posted what worked for me in that thread.
21cdb, looking forward to your solution for removing the original admin-bar.css file!
Re: your problem… you could potentially solve your problem by adding a CSS class to the body when you’re logged in or not, and then declaring a CSS override for the body.
—
In your BP member theme, add the following to your <body> tag:
<body<?php if (!is_user_logged_in() ) echo ' class="non-login"'; ?>>Then, at the bottom of your my-admin-bar.css,:
body.non-login {padding-top:0 !important;}This is untested… but in theory, this should work.
Let me know how it goes!
One thing to add, the “Settings” pages use the “plugin-template.php” file in your BP member theme’s directory.
Instead of using the <?php bloginfo(‘template_url’); ?> tag, try manually typing in the path to your CSS file and see if that works.
Remember, bp-custom.php must be located in “wp-content/plugins/“
21cdb + Carpconnect, be advised that this does not remove the core admin bar css. The original admin bar CSS file will still be listed in your HTML source.
The remove_action doesn’t quite remove it… mods, any idea why?
There we go!
One addendum for those that may be interested. Remember to call on the global variable $bp (global $bp) before calling on the $bp->$current_component.
Hi Jeff, I believe he just wants to modify the CSS and not the menus.
Thank you sir!
For groups, this seems to work:
<?php if ( bp_is_page( BP_GROUPS_SLUG ) ) : ?>YOUR STUFF<?php endif; ?>Not sure about profile… I could use that as well!
Try this…
Paste the following in your “bp-custom.php” file (‘wp-content/plugins/bp-custom.php’). If you don’t have one, make one!
function my_admin_bar_css() {
echo '<link href="LINK TO STYLESHEET" rel="stylesheet" type="text/css" media="screen,projection" />';
}
remove_action('wp_head', 'bp_core_admin_bar_css', 1);
add_action('wp_head', 'my_admin_bar_css', 1);Assuming that your admin bar stylesheet is in your member theme’s directory, you could probably use “<?php bloginfo(‘template_url’); ?>/css/your_admin_bar.css” to determine the theme’s path (I say probably b/c I’m not sure! hehe).
Might want to play around with that… in theory, it should work… *untested*.
[EDIT]
Okay I’ve tested this… and it doesn’t quite work!
The custom CSS gets loaded, but I can’t seem to remove bp_core_admin_bar_css.
Time for a mod to jump in!
Thanks Burt! You’re a savior!
The code you posted fixed all problems, including the random blogs and alpha listing.
Case “resolved”!
Thanks Jeff, I’ll take a look at that.
Here’s a follow-up question, is there a PHP function to determine if you’re on a “Settings” page? I could use $_SERVER[‘REQUEST_URI’], but am wondering if there’s already a built-in function that BuddyPress uses.
That’s exactly where I have it, Burt.
Hey Burt (and Andy),
The latest code update fixed the rogue, empty blog listing.
However, now I’m getting blog id #1 listed all the time, even though I excluded it in the $my_excluded array.
FYI, I have the following listed in the $my_excluded array:
$my_excluded = array(1,2);Blog id’s 1 and 2 happen to be my only two blogs on my testbox at the moment, so I shouldn’t be seeing any listings under the “Blogs Directory” (I don’t see blog id #2 so that’s good!).
—
Two other things I’ve noticed:
- The “Random Blogs” section will continue to show either of the excluded blogs depending on the randomness.
- Clicking on the letter whose first letter matches the excluded blog in the alphabetical listing will show the excluded blog listing.
—
Sorry to have complicated things! Probably a pain to debug!
Thanks John! Feel free to mark this topic as “resolved”.
Burt, the class override seems to work.
However, one bug I’m getting is an avatar which links to the “Blogs Directory”, as well as a link to “Visit Blog” and the “Latest Post”. Both of which also link to the “Blogs Directory”.
I also tried the new my_has_site_blogs() function on the “Random Blogs” section and the same thing happens.
I’ve taken a screenshot so you can see (ignore the ugly styling for now… still a work in progress!):
http://i41.tinypic.com/10ngnyt.jpg
Burt, I appreciate the time you’ve put into this matter so far!
*It might help to say I’m using BP 1.0.1 (not the latest trunk version) and WPMU 2.71.
Burt, I actually did try the first code you mentioned and of course, it did not work in bp-custom.php. I was actually going to post a reply to it, but you already did! Will test out the new code.
Thanks for your diligence!
—
John, one of the blogs in question would be the home blog, so we wouldn’t want to set that to “Private” and disallow search engines
But thanks for that little hint, might be useful in the future.Cheers guys!
Thanks Burt! Much appreciated!
I’ll give this code a shot and report back.
Friendly courtesy bump.
Hi John,
Thanks for getting back to me.
The link you provided requires me to register for your site, which is something I don’t want to do, but I’ll take your word for it!
—
I do have the “Blogs” component enabled (users are also able to create blogs), however like I mentioned in the first post, the comments are only listed on the user’s “Blogs > Recent Comments” page and not on the “Activity” page (right now, the “Activity” page says that the user hasn’t done anything).
I guess I should mention that the user I tested this with is a subscriber on the main blog, and has no role on the secondary blog, which the comment was made on.
Does that make a difference?
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!
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!
Okay, this seems to have fixed itself somehow.
Maybe I just had to restart Apache!
Hi gang,
Am brand new to MU and Buddypress and I have setup Buddypress on my local box
Saw this thread and it’s exactly what I want to do.
To test this out, I am using the default Kubrick Home theme, and have adjusted my home blog’s settings under “Site Admin > Blogs” to: “Path – /” and “Permalink Settings – “/%postname%/”.
When I attempt to click on the “hello-world” post under the home blog, I get a 404 error.
However, when I go to “/blog/hello-world/”, this works.
Any idea why?