This topic has 14 replies, 3 voices, and was last updated 9 years by Radu.

  • Author
  • #157527
     humbledor
    Participant

    Hi,

    I’ve setup the WordPress Social Login with Steam as the provider. I’ve come across an issue that I’m not sure how to fix. When the user registers it gets the steam profile avatar which displays correctly on the profile page and if you use the default Buddyapp my account link in top right navigation.

    However if you choose to manually add the BuddyApp ‘My Account’ link to the navigation it displays the users gravatar (even though gravatar is turned off in wordpress settings) instead of the steam profile avatar that shows everywhere else. How can this be fixed?

     

    Many thanks,

    Tom

    #157647
     Laura
    Moderator

    Hello, will assign the ticket to a higher support level who can help and advise you in your query.
    Thanks! ?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #157796
     Radu
    Moderator

    Hi,

    Can you please provide an URL and an account connected with steam to see how this it happens please ?

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #157847
     humbledor
    Participant

    It seems to be effecting BuddyApp specifically rather than default buddypress. Noticably:

    • BuddyApp Ajax Search results for members
    • BuddyApp widgets that display avatars
    • BuddyApp ‘My Account’ avatar if manually added to nav menu

    Buddypress areas show steam avatar image:
    <img src="https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/48/48e8c9b972b05bce77c08c336e8db03af67898c0_full.jpg" alt="Profile picture of [cc] Warren" class="avatar avatar-wordpress-social-login" height="184" width="184">

    BuddyApp specific areas its using gravatar:
    <img src="//www.gravatar.com/avatar/c4ef35386437208ab87e76be3e8ee215?s=25&r=g&d=mm" class="kleo-rounded" alt="">

    Website: https://continuumfall.net

    #157848
     humbledor
    Participant

    I dunno if this helps but this is the php file for wordpress social login that is used to display avatars:

    COPY CODE
    <?php
    /*!
    * WordPress Social Login
    *
    * http://miled.github.io/wordpress-social-login/ | https://github.com/miled/wordpress-social-login
    *  (c) 2011-2015 Mohamed Mrassi and contributors | http://wordpress.org/plugins/wordpress-social-login/
    */
    
    /** 
    * Displaying the user avatar when available on the comment section and top bar 
    *
    * These functions are borrowed from http://wordpress.org/extend/plugins/oa-social-login/ 
    */
    
    // Exit if accessed directly
    if( !defined( 'ABSPATH' ) ) exit;
    
    // --------------------------------------------------------------------
    
    /** 
    * Display users avatars from social networks when available
    * 
    * Note: 
    *   You may redefine this function
    */
    if( ! function_exists( 'wsl_get_wp_user_custom_avatar' ) )
    {
    	function wsl_get_wp_user_custom_avatar($html, $mixed, $size, $default, $alt)
    	{
    		//Check if avatars are enabled
    		if( ! get_option( 'wsl_settings_users_avatars' ) )
    		{
    			return $html;
    		}
    
    		//Only Overwrite gravatars
    		if( ! stristr( strtolower( $html ), 'gravatar.com' ) )
    		{
    			return $html;
    		}
    
    		//Current comment
    		global $comment;
    
    		//Chosen user
    		$user_id = null;
    
    		//Check if we have an user identifier
    		if(is_numeric($mixed))
    		{
    			if($mixed > 0)
    			{
    				$user_id = $mixed;
    			}
    		}
    
    		//Check if we are in a comment
    		elseif(is_object($comment) AND property_exists($comment, 'user_id') AND !empty($comment->user_id))
    		{
    			$user_id = $comment->user_id;
    		}
    
    		//Check if we have an email
    		elseif(is_string($mixed) &&($user = get_user_by('email', $mixed)))
    		{
    			$user_id = $user->ID;
    		}
    
    		//Check if we have an user object
    		else if(is_object($mixed))
    		{
    			if(property_exists($mixed, 'user_id') AND is_numeric($mixed->user_id))
    			{
    				$user_id = $mixed->user_id;
    			}
    		}
    
    		//User found?
    		if( $user_id )
    		{
    			$wsl_avatar = wsl_get_user_custom_avatar( $user_id );
    
    			if( $wsl_avatar )
    			{
    				$wsl_html = '<img alt="'. $alt .'" src="' . $wsl_avatar . '" class="avatar avatar-wordpress-social-login avatar-' . $size . ' photo" height="' . $size . '" width="' . $size . '" />';
    
    				// HOOKABLE: 
    				return apply_filters( 'wsl_hook_alter_wp_user_custom_avatar', $wsl_html, $user_id, $wsl_avatar, $html, $mixed, $size, $default, $alt );
    			}
    		}
    
    		return $html;
    	}
    }
    
    add_filter( 'get_avatar', 'wsl_get_wp_user_custom_avatar', 10, 5 );
    
    // --------------------------------------------------------------------
    
    /**
    * Display users avatars from social networks on buddypress
    * 
    * Note: 
    *   You may redefine this function
    */
    if( ! function_exists( 'wsl_get_bp_user_custom_avatar' ) )
    {
    	function wsl_get_bp_user_custom_avatar($html, $args)
    	{
    		//Buddypress component should be enabled
    		if( ! wsl_is_component_enabled( 'buddypress' ) )
    		{
    			return $html;
    		}
    
    		//Check if avatars display is enabled
    		if( ! get_option( 'wsl_settings_users_avatars' ) )
    		{
    			return $html;
    		}
    
    		//Check arguments
    		if( is_array( $args ) )
    		{
    			//User Object
    			if( ! empty( $args['object'] ) AND strtolower( $args['object'] ) == 'user' )
    			{
    				//User Identifier
    				if( ! empty( $args['item_id'] ) AND is_numeric( $args['item_id'] ) )
    				{
    					$user_id = $args['item_id'];
    
    					//Only Overwrite gravatars
    					# https://wordpress.org/support/topic/buddypress-avatar-overwriting-problem?replies=1
    					if( bp_get_user_has_avatar( $user_id ) )
    					{
    						return $html;
    					}
    
    					$wsl_avatar = wsl_get_user_custom_avatar( $user_id );
    
    					//Retrieve Avatar
    					if( $wsl_avatar )
    					{
    						$img_class  = ('class="' .(!empty($args ['class']) ?($args ['class'] . ' ') : '') . 'avatar-wordpress-social-login" ');
    						$img_width  = (!empty($args ['width']) ? 'width="' . $args ['width'] . '" ' : 'width="' . bp_core_avatar_full_width() . '" ' );
    						$img_height = (!empty($args ['height']) ? 'height="' . $args ['height'] . '" ' : 'height="' . bp_core_avatar_full_height() . '" ' );
    						$img_alt    = (!empty( $args['alt'] ) ? 'alt="' . esc_attr( $args['alt'] ) . '" ' : '' );
    
    						//Replace
    						$wsl_html = preg_replace('#<img[^>]+>#i', '<img src="' . $wsl_avatar . '" ' . $img_alt . $img_class . $img_height . $img_width . '/>', $html );
    
    						// HOOKABLE: 
    						return apply_filters( 'wsl_hook_alter_get_bp_user_custom_avatar', $wsl_html, $user_id, $wsl_avatar, $html, $args );
    					}
    				}
    			}
    		}
    
    		return $html;
    	}
    }
    
    add_filter( 'bp_core_fetch_avatar', 'wsl_get_bp_user_custom_avatar', 10, 2 );
    
    // --------------------------------------------------------------------
    
    #158113
     Radu
    Moderator

    I see, can you please provide FTP login and admin login credentials to test the fix live on this ?

    Credentials will be provided in a private reply

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #158121
     humbledor
    Participant

    Hi hope this helps:

    FTP username: seventhqueen@continuumfall.net
    FTP server: http://ftp.continuumfall.net
    FTP port: 21
    FTP Password: mICnkDx0wlWg7fqWKm

    #158128
     humbledor
    Participant

    Oh and admin account:

    login: https://continuumfall.net/wp-login.php
    username: seventhqueen
    password: mICnkDx0wlWg7fqWKm

    #158457
     Radu
    Moderator

    Hi,

    It’s fixed check it, this will be fixed on next theme update

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #158472
     humbledor
    Participant

    Hi thanks Radu,

    I can see that the my account avatar is working but I noticed the kleo ajax search is still using gravatar when I look at the source html?

    Thanks

    #158934
     Radu
    Moderator

    Fixed, check it

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #159078
     humbledor
    Participant

    eh? you commented out the avatar part in the theme-functions.php? no avatar showing at all now lol

    #159101
     humbledor
    Participant

    $image = kleo_get_avatar($image_args);

    This seems to just get the avatar of the logged in user not the corresponding user that displays in the search result e.g. all user results have the logged in users avatar.

    #159104
     humbledor
    Participant

    Ah you forgot to add back item_id to the image_args:

    COPY CODE
    $image_args = array (
    'item_id' => $member-> ID,
    'width'   => 40,
    'height'  => 40
    );
    $image = kleo_get_avatar($image_args);
    #159439
     Radu
    Moderator

    Hi,

    Oh.. yes.. you right, I’ve forgotten to specify the member id argument ..sorry for that, I will fix in theme right now, on your install it’s ok right now I guess.

    Let me know

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 15 posts - 1 through 15 (of 15 total)

The forum ‘Bugs & Issues’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?