Jump to content
Sign in to follow this  

Avatars issues with buddy press.

Recommended Posts


Yes I think there is a correlation. What happens is that when registering a user is passed through a screen that tells them to upload a picture. But those users might have a gravatar linked to their email. Once registered the uploaded avatar is the primary avatar, overiding the gravatar. This is true for wordpress and buddypress, but bbpress. Bbpress only displays the gravatar and if a user does not then it shows an empty profile picture. Do you guys know if there is a plugin that fixes, or a code that could behave the same as in wordpress and buddypress, so that the avatar can be consistent throughout the site? I hope this makes sence.

Share this post

Link to post
Share on other sites

@Bryan Yeah thank you I do know that they have different setups. But I have found so far through this link: http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-to-definitively-display-buddypress-avatars-in-bbpress/?topic_page=2&num=15#post-90475 That by modifying the functions.php file to this:

	define('FTHEMENAME', 'Platform Forum');
	define('ADDONTO', 'PlatformPro');
	define('ADDONTOVERSION', '1.0.0');
	define('VPRO', true);
	define('FTDOMAIN', 'PlatformForum');
		define('FPATH', bb_get_theme_directory());
		define('FINC', FPATH . 'includes/');
		define('FADMIN', FINC . 'admin/');
		define('FFUNCTIONS', FINC . 'functions/');
		define('FURI', bb_get_uri());
		define('FROOT',  bb_get_active_theme_uri());
		define('FCSS', FROOT . 'css/');
		define('FJS', FROOT . 'js/');
		define('FIMAGE', FROOT . 'images/');
		define('BBLANGUAGE_FOLDER', FPATH.'languages/');
		bb_load_theme_textdomain(FTDOMAIN, BBLANGUAGE_FOLDER);
	// BBPRESS INTEGRATION FIXES (if magic quotes turned off)
		add_filter('pre_post', 'stripslashes', 40);
		add_filter('pre_post', 'stripslashes', 45); // 2nd Time
		add_filter('pre_topic_title', 'stripslashes', 40);
		add_filter('bb_add_topic_tags', 'stripslashes', 40);
	/***** REQUIRE FILES ON LOAD ******/
	/***** Avatar ******/
	function bb_bp_avatar($avatar, $id_or_email, $size, $default, $alt) {
		$class = 'photo avatar avatar-'. $size;
		$author_id = get_post_author_id();
		$avatar_folder_url = '/wp-content/uploads/avatars/'. $author_id;
		$avatar_folder_dir = $_SERVER['DOCUMENT_ROOT'] . $avatar_folder_url;
		$avatar_name = ( 'full' == $type ) ? '-bpfull' : '-bpthumb';
		$legacy_user_avatar_name = ( 'full' == $type ) ? '-avatar2' : '-avatar1';
		if ( file_exists( $avatar_folder_dir ) ) {
			if ( $av_dir = opendir( $avatar_folder_dir ) ) {
				while ( false !== ( $avatar_file = readdir($av_dir) ) ) {
					if ( preg_match( "/{$avatar_name}/", $avatar_file ) || preg_match( "/{$legacy_user_avatar_name}/", $avatar_file ) )
						$avatar_url = $avatar_folder_url . '/' . $avatar_file;
			if ( $avatar_url )
				return "";
		return $avatar;
	add_filter( 'bb_get_avatar', 'bb_bp_avatar', 1, 5 );[/code]

Code from: http://pastebin.com/PDeF3kjm That the avatar of the bbpress posts shows the correct one uploaded through the buddypress. The question that I am trying to figure out is how to do the same thing for the topic authors? Or even is there a simpler way to recall buddypress topic or post avatar. If you have any thoughts on this that would be great. otherwise well hopefully, Ill figure out soon.

Share this post

Link to post
Share on other sites

well usually author avatars are set under users any time during or after they create their account, So are these topic authors originating from WP, BP, or BB? I know that you have buddypress avatars showing in bbPress but i'm not clear on where they aren't showing because it sounds like it's a matter of just finding the right file.

Share this post

Link to post
Share on other sites

Hey cmunns: Well those avatar are set up on registration using the register section: http://www.gradiduncut.com/register/ Which is a buddypress feature that then asks for an avatar to upload. If not it looks for a gravatar, if not again it then assign a default blank avatar. The Problem is then that when in bbpress, bbpress only pulls up gravatars or default avatars it does not pull up the uploaded avatar of the buddypress (as I guess they are different systems). But as you can see some smart guy came up with a work around that does pull up the buddypress uploaded avatar and puts it into bbpress but unfortunatly only for posts and not for the topic author.

Share this post

Link to post
Share on other sites

Thanks for sharing, karma point. Thanks, Bryan

Share this post

Link to post
Share on other sites
Non that I know about. I use an avatar plugin for my site that works cross browser and in all environments. It's called Simple Local Avatars.

Former PageLines Moderator, Food Expert and Raconteur

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this