Jump to content


Photo
- - - - -

Avatars issues with buddy press.


  • Please log in to reply
11 replies to this topic

#1 julesmoretti

julesmoretti

    Advanced Member

  • Members
  • PipPipPip
  • 75 posts

Posted 08 February 2011 - 07:57 AM

Some yes some not.

#2 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts
  • Country: Country Flag

Posted 08 February 2011 - 08:09 AM

Is there a correlation then?

#3 julesmoretti

julesmoretti

    Advanced Member

  • Members
  • PipPipPip
  • 75 posts

Posted 09 February 2011 - 08:15 PM

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.

#4 bryan-hadaway

bryan-hadaway

    Advocate

  • Members
  • PipPipPipPipPip
  • 3697 posts

Posted 10 February 2011 - 01:57 AM

Just to make sure, you know that WordPress and bbPress both have their own separate settings for avatars that need to be set in Discussion.

Here's a plugin:

http://bbpress.org/p.../avatar-upload/

Thanks, Bryan

#5 julesmoretti

julesmoretti

    Advanced Member

  • Members
  • PipPipPip
  • 75 posts

Posted 22 February 2011 - 06:19 AM

@Bryan

Yeah thank you I do know that they have different setups. But I have found so far through this link:
http://buddypress.or...m=15#post-90475

That by modifying the functions.php file to this:
 <?php
	
	define('FTHEMENAME', 'Platform Forum');
	define('ADDONTO', 'PlatformPro');
	define('ADDONTOVERSION', '1.0.0');
	define('VPRO', true);
	define('FTDOMAIN', 'PlatformForum');
	
	// DEFINE DIRECTORY CONSTANTS
		define('FPATH', bb_get_theme_directory());
		define('FINC', FPATH . 'includes/');
		define('FADMIN', FINC . 'admin/');
		define('FFUNCTIONS', FINC . 'functions/');
	
	// DEFINE WEB FOLDERS
		define('FURI', bb_get_uri());
		define('FROOT',  bb_get_active_theme_uri());
		define('FCSS', FROOT . 'css/');
		define('FJS', FROOT . 'js/');
		define('FIMAGE', FROOT . 'images/');
	
	// LOCALIZATION
	
		define('BBLANGUAGE_FOLDER', FPATH.'languages/');
		bb_load_theme_textdomain(FTDOMAIN, BBLANGUAGE_FOLDER);
	
	// BBPRESS ADDS
		bb_enqueue_script('jquery');
	
	// 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 ******/
	
	// DEEP INTEGRATION WITH WORDPRESS & THEME
	
		bb_load_template('deep_integration.php');
	
	/***** 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;
				}
			}
			closedir($av_dir);
	
			if ( $avatar_url )
				return "<img src='{$avatar_url}' alt='{$alt}' />";
		}
	
		return $avatar;
	}
	add_filter( 'bb_get_avatar', 'bb_bp_avatar', 1, 5 );

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.

#6 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts
  • Country: Country Flag

Posted 22 February 2011 - 05:00 PM

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.

#7 julesmoretti

julesmoretti

    Advanced Member

  • Members
  • PipPipPip
  • 75 posts

Posted 23 February 2011 - 02:02 AM

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.

#8 bryan-hadaway

bryan-hadaway

    Advocate

  • Members
  • PipPipPipPipPip
  • 3697 posts

Posted 23 February 2011 - 03:44 AM

Thanks for sharing, karma point. Thanks, Bryan

#9 buddha

buddha

    Super Member

  • Members
  • 107 posts
  • Framework Version:2.3.3
  • Country: Country Flag

Posted 07 October 2011 - 08:17 PM

any updates to this issue?

#10 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 08 October 2011 - 06:11 PM

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.