Changing Buddypress default logo with a custom logo in buddypress admin bar

Jotted by brajesh on July 26, 2009

Do you use buddypress? If you use buddypress, you might have seen the buddypress admin bar.

here is a small screenshot for reference.

buddypress admin bar

As expected,most of  the time you will like to brand your site and will be using your custom theme for your buddypres powered site.

and here is what do I mean by buddypress admin bar logo
buddypress admin bar logo

How do you change the byddypress logo in the buddypress admin bar? do you edit the  bp-core/bp-core-adminbar.php or upload image to bp-core/images direcotry.These are not recommended as It will wipe out your customization with the next upgrade of buddypress.

Well,So here Is an easier way , you can use to add your own logo and custom alt text for the logo in the buddypress admin bar.

Buddypress provides two hooks for the purpose

bp_admin_bar_logo_src and bp_admin_bar_logo_alt_text .You cn use these filters to easily specify your logo/alt text without tempering with the core file.

Now let me show you an example how to do it

First of all ,we need to add the filters

<?php
/*Let us add the filters */
add_filter("bp_admin_bar_logo_src","cc_my_adminbar_logo");//it will help us modify the logo image
add_filter("bp_admin_bar_logo_alt_text","cc_my_adminbar_logo_alt_text");
//allows you to change the alt text specified for your site
 
?>

As you may see,we have just added the two filters, now we need to define the two functions cc_my_adminbar_logocc_my_adminbar_logo_alt_text.
These function names can be anything, just make sure you use the same name in function definition ,which you used in the “apply_filters

The function “cc_my_adminbar_logo” returns the absolute url of the image you want to use in place of buddypress default logo. and the function “cc_my_adminbar_logo_alt_text” will return the alt text we want to be used with the admin bar logo.By default it is “buddypress”.
So ,let us complete our code.

<?php
/*Let us add the filters */
add_filter("bp_admin_bar_logo_src","cc_my_adminbar_logo");//it will help us modify the logo image
add_filter("bp_admin_bar_logo_alt_text","cc_my_adminbar_logo_alt_text");
//allows you to change the alt text specified for your site
 
 
 
/*
* cc_my_adminbar_logo($default_logo_src) returns the absolute url of your custom image
*/
function  cc_my_adminbar_logo($default_logo_src)
{
/*let us ignore the defult buddypress logo url,which is passed as the first arguement*/
$my_logo_url="http://example.com/custom-adminbar-logo.png";
/*change the value of $my_logo_url with your own custom logo;
*/
return $my_logo_url;
}
 
/**
*cc_my_adminbar_logo_alt_text($defult_alt_text) 
* returns the custom alt text from admin bar logo
*/ 
function cc_my_adminbar_logo_alt_text($defult_alt_text)
{
/*ignore the default text*/
 
$my_logo_alt_text="MyWonderFulSite description";
/*Please change the $my_logo_alt_text value with your own custom value
*/
 
return $my_logo_alt_text;
}
?>

That’s it, we return our own admin bar logo url and the alt text.

To use it on your site, modify the above code with your custom requirement(logo url and text).Put it in some php file and upload it to wp-content/mu-plugins directory,go and visit your site.The logo will be changed.

Though,It’s simple,I hope it helps.Let me know ,how it goes with you.

Note: There was a typing mistake in the original article as pointed by Eduardo,now it is corrected.Thanks Eduardo for pointing.

[blinklist] [Bloglines] [del.icio.us] [Digg] [dzone] [Facebook] [Ma.gnolia] [Mister Wong] [Reddit] [Sphere] [Sphinn] [StumbleUpon] [Technorati] [Email]


Anyone Interested in helping Beta testing of Wp Unique Article Header Image Plugin

Jotted by brajesh on July 24, 2009

Hi there

have you used my plugin Wp Unique Article header image.

I have just finished a the new version of this plugin which allows following

  • Add Unique header Image to single post/single page
  • Add Unique header Image to home page
  • Add Unique header Image to archive/category/author page
  • Add Unique header Image to search page
  • Add Unique header Image to 404 page

Well,That is just the brief.I have modified the plugin to support both PHP4 and PHP5.It is ready and I have tested it with wp 2.8.2.

I need you people to test it on PHP4 server(as I have PHP5 only servers/local installations)

If you want to experience the new plugin ,please drop me a line/leave a comment  and I will send you a zip,I will be glad to mention your name at this blog as helping hands/beta testers.

I look forward to your help and participation in the beta testing of the plugin.

Thanks

Brajesh

update:20th August 2009
Here is the attached file for download.Please let me know your suggestions and findings.
Wp Unique header 1.1 (72)

[blinklist] [Bloglines] [del.icio.us] [Digg] [dzone] [Facebook] [Ma.gnolia] [Mister Wong] [Reddit] [Sphere] [Sphinn] [StumbleUpon] [Technorati] [Email]


Slightly hacked Slimbox plugin to be used across all blogs on a wordpress mu/buddypress based site

Jotted by brajesh on July 10, 2009

On the request of one of my friend,I just hacked slimbox to make it work across all blogs on a wordpress Mu network.

So you want to be able to use the slimbox/lightbox  effect across all blogs on your buddypress/wordpress mu based site
here is a hacked version of slimbox plugin to make it work with wordpress Mu network.
You only need to unzip and upload the files slimbox.php ,and the folder “slimbox” to wp-content/mu-plugins directory and you are done.

It will get automatically activated across all blogs on your wordpress Mu installation.

Check the original plugin for wordpress here http://wordpress.org/extend/plugins/slimbox/

and here is my hacked version of the slimbox for wordpress Mu SlimBox for wordpress Mu/buddypress based site (195).

hope,It was useful.I will love to hear from you .

regards

Brajesh

[blinklist] [Bloglines] [del.icio.us] [Digg] [dzone] [Facebook] [Ma.gnolia] [Mister Wong] [Reddit] [Sphere] [Sphinn] [StumbleUpon] [Technorati] [Email]



Get Adobe Flash playerPlugin by wpburn.com wordpress themes