• Hi again,

    I have set up the plugin to retrieve social avatar when loggin with social networks.

    I am also working with ultimate member plugin for community.

    The social login with supersocializer works, but is not pulling the avatar.

    Is this a know issue? Something i need to change?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter rateyourway

    (@rateyourway)

    ok, if i deactivate the plugin, the avatar pulls fine from ultimate member login function.

    Is there a compatibility problem between both plugins?

    Plugin Author Heateor Support

    (@heateor)

    Thread Starter rateyourway

    (@rateyourway)

    Thanks,

    I found the thread, however i’m a bit confused about which is the final code that needs to be pasted

    Try commenting out (placing // before the line) following lines:
    remove_filter(‘get_avatar’, ‘um_get_avatar’, 99999, 5);
    and
    add_filter(‘get_avatar’, ‘um_get_avatar’, 99999, 5);

    i don’t know exactly what to add or remove…sorry ??

    Also, can i include this code in my custom PHP?

    Plugin Author Heateor Support

    (@heateor)

    Try adding following code at the end of functions.php file of your current theme/child theme:

    /**
     * Replace default avatar with social avatar
     */
    function heateor_ss_custom_social_avatar($avatar, $avuser, $size, $default, $alt = '') {
    	global $theChampLoginOptions;
    	if(isset($theChampLoginOptions['avatar_quality']) && $theChampLoginOptions['avatar_quality'] == 'better'){
    		$avatarType = 'thechamp_large_avatar';
    	}else{
    		$avatarType = 'thechamp_avatar';
    	}
    	$userId = 0;
    	if(is_numeric($avuser)){
    		if($avuser > 0){
    			$userId = $avuser;
    		}
    	}elseif(is_object($avuser)){
    		if(property_exists($avuser, 'user_id') AND is_numeric($avuser->user_id)){
    			$userId = $avuser->user_id;
    		}
    	}
    	if($avatarType == 'thechamp_large_avatar' && get_user_meta($userId, $avatarType, true) == ''){
    		$avatarType = 'thechamp_avatar';
    	}
    	if(!empty($userId) && ($userAvatar = get_user_meta($userId, $avatarType, true)) !== false && strlen(trim($userAvatar)) > 0){
    		return '<img alt="' . esc_attr($alt) . '" src="' . $userAvatar . '" class="avatar avatar-' . $size . ' " height="' . $size . '" width="' . $size . '" />';
    	}elseif(function_exists('um_fetch_user')){
    		if ( is_numeric($avuser) )
    			$userId = (int) $avuser;
    		elseif ( is_string( $avuser ) && ( $user = get_user_by( 'email', $avuser ) ) )
    			$userId = $user->ID;
    		elseif ( is_object( $avuser ) && ! empty( $avuser->user_id ) )
    			$userId = (int) $avuser->user_id;
    		if ( empty( $userId ) )
    			return $avatar;
    
    		um_fetch_user( $userId );
    
    		$avatar = um_user('profile_photo', $size);
    
    		if ( !um_profile('profile_photo') && um_get_option('use_gravatars') ) {
    			if ( is_ssl() ) {
    				$protocol = 'https://';
    			} else {
    				$protocol = 'https://';
    			}
    
    			$default = get_option( 'avatar_default', 'mystery' );
    			if ( $default == 'gravatar_default' ) {
    				$default = '';
    			}
    
    			$rating = get_option('avatar_rating');
    			if ( !empty( $rating ) ) {
    				$rating = "&r={$rating}";
    			}
    
    			$avatar = '<img src="' . $protocol . 'gravatar.com/avatar/' . md5( um_user('user_email') ) .
    			'?d='. $default . '&s=' . $size . $rating .'" class="gravatar avatar avatar-'.$size.' um-avatar" width="'.$size.'" height="'.$size.'" alt="" />';
    
    		}else if( empty( $avatar ) ){
    			$defaultAvatarUri = um_get_defaultAvatarUri();
    			$avatar = '<img src="' .$defaultAvatarUri  .'" class="gravatar avatar avatar-'.$size.' um-avatar" width="'.$size.'" height="'.$size.'" alt="" />';
    		}
    	}
    	return $avatar;
    }
    add_filter('get_avatar', 'heateor_ss_custom_social_avatar', 100000, 5);
    Thread Starter rateyourway

    (@rateyourway)

    Thanks for the code! it works perfectly, so i can now integrate both login options ??

    amazing, thanks!

    Plugin Author Heateor Support

    (@heateor)

    You’re welcome ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Avatar is not showing’ is closed to new replies.