Support » Plugin: WordPress Social Login » [Plugin: WordPress Social Login] Account Email and Avatars

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter snatrott

    (@snatrott)

    Does anyone know of a way to fix this or will it be fixed in the next release?

    This is the best social login I could find, and it is useless if the email doesn’t work when logging in.

    Hi snatrott,

    How did you manage to link buddypress users to wordpress users??

    (i’m still facing this issue: http://wordpress.org/support/topic/plugin-wordpress-social-login-integration-with-buddypress )

    Thread Starter snatrott

    (@snatrott)

    I didn’t do anything special to connect buddypress and wordpress users. I am using WP 3.3.1 and BuddyPress 1.5.3.1. The users were automatically added to the regular user area.

    The wsl_user_custom_avatar function in wordpress-social-login/includes/plugin.ui.php, which is borrowed from the Social Login plugin, only gets the social networking avatar for comments on the front end. It does not get the avatar for the user’s admin bar or in the admin area users list, etc.

    To make the social networking avatars work throughout, you can put this code into your theme or a custom plugin…

    // remove WordPress Social Login's get_avatar filter so that we can add our own
    remove_filter( 'get_avatar', 'wsl_user_custom_avatar' );
    function my_user_custom_avatar($avatar, $id_or_email, $size, $default, $alt) {
            global $comment;
    
            if( get_option ('wsl_settings_users_avatars') && !empty ($avatar)) {
                    //Check if we are in a comment
                    if (!is_null ($comment) && !empty ($comment->user_id)) {
                            $user_id = $comment->user_id;
                    } elseif(!empty ($id_or_email)) {
                            if ( is_numeric($id_or_email) ) {
                                    $user_id = (int) $id_or_email;
                            } elseif ( is_string( $id_or_email ) && ( $user = get_user_by( 'email', $id_or_email ) ) ) {
                                    $user_id = $user->ID;
                            } elseif ( is_object( $id_or_email ) && ! empty( $id_or_email->user_id ) ) {
                                    $user_id = (int) $id_or_email->user_id;
                            }
                    }
                    // Get the thumbnail provided by WordPress Social Login
                    if ($user_id) {
                            if (($user_thumbnail = get_user_meta ($user_id, 'wsl_user_image', true)) !== false) {
                                    if (strlen (trim ($user_thumbnail)) > 0) {
                                            $user_thumbnail = preg_replace ('#src=([\'"])([^\\1]+)\\1#Ui', "src=\\1" . $user_thumbnail . "\\1", $avatar);
                                            return $user_thumbnail;
                                    }
                            }
                    }
            }
            // No avatar found.  Return unfiltered.
            return $avatar;
    }
    
    add_filter ( 'get_avatar', 'my_user_custom_avatar', 10, 5);

    …Or, if you want to hack the WSL plugin, you could replace the content of the wsl_user_custom_avatar function in wordpress-social-login/includes/plugin.ui.php with the content of the my_user_custom_avatar function above.

    Email is not one of the fields that LinkedIn makes available to pull in via their API:
    https://developer.linkedin.com/documents/profile-fields (In the code comments of the plugin there’s a note that “Currently only Facebook, Google, Yhaoo and Foursquare do provide the verified user email.”) So the WP Social Login plugin generates a fake email for the user. The code is in wordpress-social-login/includes/plugin.auth.php.

    Perhaps the email field could just be left blank, but maybe that would keep the login process from continuing properly. I’ll be testing this soon.

    Plugin Author Miled

    (@miled)

    as jlnd said, not all networks provide the user email, and we simply have to create a fake one to complete the user registration.

    also i added the code provided by jlnd to display the user avatar ( this should be available on the next release as well)
    Thanks a lot!

    @jlnd I put you function into the functions.php of my child theme for buddypress but nothing changed. The only place the avatar shows up is in the comment form. It doesn’t show where I use bp_loggedin_user_avatar, bp_displayed_user_avatar, and bp_core_fetch_avatar. It does appear to work for get_avatar though. What can I add to make it work on all of those places?

    @enderpal444, I don’t use Buddy Press so I’m not positive but you might be able to get things to work by rearranging the priority order of your filters. In the code above, try changing the 10 in the last line to 15.

    If that works, it might be necessary to customize the function a bit to only use the social avatar if buddy press doesn’t have one. To do so, add the following code at the 4th line (the blank line)…

    // Only continue if there is no buddy press avatar
    if( $avatar != ” && strpos($avatar, ‘gravatar’) === false ) {
    return $avatar;
    }

    Hi jlnd! This still isn’t working for me =(. Any other ideas? This would be so perfect for me if I could get this to work.

    What we need is a popup dialog box for users that login with a service that does provide an email.

    “Please enter your email to continue logging”

    I know this plugin has this feature “http://wordpress.org/extend/plugins/loginradius-for-wordpress/”, but I don’t like how its a SaaS.

    Anyway of making this happen? I’ll supply the coffee 🙂

    I’m having similar issues with:
    1 – none of the avatars pulling through
    2 – the lack of email address from some social networks. This is a problem as I’ve a form setup that allows registered users to claim a free blog where I depend on them updating their email address.

    The enter your email as mentioned above would just be a tidier, more elegant solution! I previously had the LoginRadius plugin running and it did all that, but didn’t play nicely with a multisite install.

    If Ivnus is bringing the coffee, shall I bring the biscuits (cookies)?

    The problem still persists. I guess the theme author has included the code provided by @jlnd in this thread above. I have downloaded the latest version of this plugin but the avatars ain’t getting generated.

    I have installed Theme-my-login plugin and interestingly, the avatar displayed in the sidebar by Theme-my-login gives excellent results of fetching the avatar from social networks. But the avatars on the members page still remains blank.

    So my conclusion is that the bug is in the theme – not with the wordpress social login plugin.

    I am not sure, though, where to find that bug in the theme files. I am using default buddypress theme with buddypress enabled.

    I was previously using the plugin by Login Radius which pulled the avatars through fine but wasn’t suitable for multisite. So in my case, the issue has started when I changed to this plugin.

    What I can’t confirm is whether it’s a permissions issue with my hosting, which is the only other thing that changed in the same period.

    @mudandroutes – I know they say Login Radius works for Multisite, but what did you find bad about the Login Radius plugin?

    I was thinking of switching until WP Social Login was setup to ask for email addresses on twitter, linkedIn sign ins, and domain name SSO.

    I think I can safe speak for myself and mudandroutes, that we would both love to see these features.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Plugin: WordPress Social Login] Account Email and Avatars’ is closed to new replies.