[buddypress-dev] My experience upgrading to latest Trunk r337

phlux0r phlux0r at gmail.com
Fri Sep 12 23:54:04 GMT 2008


I took the plunge yesterday and upgraded to the most recent changes in 
Buddypress. I decided to start from scratch as it seemed it would take 
more time to retro fit everything and make it work as I already had a 
number of blogs and users etc... All in all, I had to make a few 
modifications to my custom functions that interact with buddypress but 
nothing too major and everything works as expected now. In the process I 
noticed a couple of bugs in the bp_core_get_avatar() function so here's 
my version of it (changes highlighted in red):

function bp_core_get_avatar( $user, $version = 1, $no_tag = false, $width = null, $height = null ) {
	if ( !is_int($version) )
		$version = (int) $version;

	if ( CORE_AVATAR_V2_W == false && CORE_AVATAR_V2_H == false )
		$version = 1;

	$home_base_id = get_usermeta( $user, 'home_base' );
	$url = get_blog_option($home_base_id, 'siteurl');

	if ( !$width )
		$width = constant('CORE_AVATAR_V' . $version . '_W');

	if ( !$height )
		$height = constant('CORE_AVATAR_V' . $version . '_H');

	$str = get_usermeta( $user, "bp_core_avatar_v$version" );

	if ( strlen($str) ) {
		if ( $no_tag )
			return $url . '/' . $str;
		else
			return '<img src="' . $url . '/' . $str . '" alt="" class="avatar" width="' . $width . '" height="' . $height . '" />';
	} else {
		if ( $no_tag )
			return CORE_DEFAULT_AVATAR_THUMB;
		else
			return '<img src="' . CORE_DEFAULT_AVATAR . '" alt="" class="avatar" width="' . $width . '" height="' . $height . '" />';
	}
}


However, I'd like to see this function to be a bit more flexible and 
allow for custom alt and title tags. Also, if $no_tag is true, it would 
be nice if it returned both the image URL and the profile URL.

Anyhow, I'm quite pleased with this new version but I'd like to have the 
option to not display the user admin nav on the front end when the user 
is logged in and on the main site blog as, I'm sure, many people would 
want to do their own 'user thing' on the main site blog. For example, I 
have a box in the sidebar on my main home theme showing the logged in 
user and some quick links... Is there an easy hack to just display the 
top admin bar on the user home base or on the profile theme only? I 
guess I could move the add_action( 'wp_footer', 'bp_core_admin_bar' ); 
to the buddypress theme? I realise that this is still very much WIP and 
I'm sure these things will be refined...

Cheers for the good work on this, much appreciated!


Kind regards,
Robert


More information about the buddypress-dev mailing list