Google+ Avatars too small (50x50 px)

Hi,

I am the owner of PCsteps.gr and I have a Plus Plan with Oneall .

When a user logs in my website with Google plus, the avatar the OA Social Login imports has an sz?=50 parameter which makes it too small. I mainly have a problem with the authors on my site, because the author box requires an 140x140px image.

Example: https://lh4.googleusercontent.com/-pOUT-6kf3yE/AAAAAAAAAAI/AAAAAAAAUJ0/76hXWUzkUTY/photo.jpg?sz=50

Is there any way to change this s=?50 parameter for Google Plus, or remove it altogether?

Thank you

Angelos Kyritsis

Best Answer

  • Fred_PinelFred_PinelMember
    Answer ✓
    Hi,
    One way to change this url is to use an action to one of the plugin's hooks, which will edit the picture link.
    So, in the file functions.php of your theme, try this:
    function edit_picture_url ($userdata, $profile, $redirect) { $picture = str_replace ('?sz=50', '', get_user_meta ($userdata->ID, 'oa_social_login_user_picture', true)); update_user_meta ($userdata->ID, 'oa_social_login_user_picture', $picture); $thumbnail = str_replace ('?sz=50', '', get_user_meta ($userdata->ID, 'oa_social_login_user_thumbnail', true)); update_user_meta ($userdata->ID, 'oa_social_login_user_thumbnail', $thumbnail); // you can add error_log ('changed: '. $picture .', '. $thumbnail); to keep a trace of the changes. } add_action('oa_social_login_action_before_user_redirect', 'edit_picture_url', 10, 3);
    An alternative is to inspect the $profile fields, and look for a more appropriate field to use as picture (there does not seem to be one though).

    Hope it helps.

Answers

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.