Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Miled

    (@miled)

    yes, that’s how it is implemented:

    https://plugins.trac.www.ads-software.com/browser/wordpress-social-login/tags/2.2.2/includes/services/wsl.user.avatar.php#L88

    i think i may add an if statement to only overwrite gravatar urls, however i’m open to other suggestions tho.

    Thread Starter Leandro Padula

    (@leandrox)

    An “is” could be a good solutions…

    in my function.php i have implemented this:

    function add_buddypress_avatar( $user_id, $provider, $hybridauth_user_profile ) {
    
    	$user    = get_userdata( $user_id );
    	$uploads = wp_upload_dir();
    	define( 'AC_AVATAR_BASE_PATH', $uploads['basedir'] . '/avatars/' );
    	define( 'AC_PROFILE_PHOTO_BASE_PATH', $uploads['basedir'] . '/social/' );
    
    	$avatarUrl = get_user_meta( $user_id, 'wsl_user_image', true );
    
    //	$ch = curl_init( $avatarUrl . '&redirect=false' );
    	$ch = curl_init( $avatarUrl );
    	curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
    	curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 10 ); // Mean 10 seconds
    	$content = curl_exec( $ch );
    	$data    = json_decode( $content, true );
    	curl_close( $ch );
    
    	if ( !file_exists( AC_AVATAR_BASE_PATH . $user->ID ) ) {
    		mkdir( AC_AVATAR_BASE_PATH . $user->ID, 0777, true );
    		copy( $data["data"]["url"], AC_AVATAR_BASE_PATH . $user->ID . '/avatar-' . $user->user_nicename . '-bpfull.jpg' );
    		copy( $data["data"]["url"], AC_AVATAR_BASE_PATH . $user->ID . '/avatar-' . $user->user_nicename . '-bpthumb.jpg' );
    	}
    }
    
    add_action( 'wsl_hook_process_login_before_redirect', 'add_buddypress_avatar', 10, 3 );
    Thread Starter Leandro Padula

    (@leandrox)

    I mean… an “if” statement.

    Plugin Author Miled

    (@miled)

    i assume you are using a previous version? things have changed in wsl 2.2.

    there is now a new function to get the user avi:
    https://plugins.trac.www.ads-software.com/browser/wordpress-social-login/tags/2.2.2/includes/services/wsl.user.data.php#L42

    wsl_hook_process_login_before_redirect has been depreciated and will be removed
    https://plugins.trac.www.ads-software.com/browser/wordpress-social-login/tags/2.2.2/includes/services/wsl.authentication.php#L783

    Plugin Author Miled

    (@miled)

    fixed on trunk: r1012313 and scheduled for wsl 2.2.3.

    starting from the next release, wsl will only overwrite gravatar avatars.

    besides that i made few other enhancements:

    1. wsl will default to bp_core_avatar_full_width() / bp_core_avatar_full_height() to display users avatars in buddypress
    2. made wsl_bp_user_custom_avatar and wsl_get_wp_user_custom_avatar pluggable
    3. added two filters hooks to overwrite the avatar html tag generated by wsl

    Thread Starter Leandro Padula

    (@leandrox)

    Great! Thanks.

    nice, thank you, can’t wait 2.2.3 ??

    I have explore wsl 2.2.3 and found WSL end-points at WordPress Social Login Diagnostics on my development site.

    Check if WSL end-points urls are reachable. FAIL!

    i try to open link given, it was available, why on admin it say fail?

    tecbay

    (@tecbay)

    So, the 2.2.3 fixed this problem or not?

    I’m using buddypress in last version.

    I had added this (on bp-custom) to fix avatar size, buts this plugins was not affected…
    define ( ‘BP_AVATAR_THUMB_WIDTH’, 75 );
    define ( ‘BP_AVATAR_THUMB_HEIGHT’, 75 );
    define ( ‘BP_AVATAR_FULL_WIDTH’, 200 );
    define ( ‘BP_AVATAR_FULL_HEIGHT’, 200 );

    @miled I am using wsl 2.2.3 but the imported images are being forced to 150px x 150px and not the default.

    class=”avatar avatar-wordpress-social-login” height=”150″ width=”150″

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Buddypress and User Avatar’ is closed to new replies.