Support » Plugin: Nextend Social Login and Register (Facebook, Google, Twitter) » Avatar problem in Firefox (Works in Chrome)

  • Hi,

    For some reason when I register with Facebook in Firefox, the avatar doesn’t show up.

    But if i do the same thing in Chrome, the avatar shows up fine.

    I thing it has something to do with src and srcset. I used Inspect Element in my browser and got this code:

    <img alt="" src="" srcset=" 2x" class="author_gravatar alignright_icon img-rounded avatar-30 photo" height="30" width="30">

    For some reason, in Firefox, it uses the scrset value instead of the src one (FB pic).

    So it fetches the profile picture from FB successfully, it just doesn’t show it on the site. It still shows Gravatar instead.

    In Chrome it works fine.

    Can anyone please help? I’ve read some other threads about this and there’s no solution yet.


Viewing 2 replies - 1 through 2 (of 2 total)
  • I fixed it by adding one line (see below) to this function in the nextend-facebook-connect.php file.

    Can anyone check and tell me if what i did is a good solution?

    add_filter('get_avatar', 'new_fb_insert_avatar', 5, 5);
    function new_fb_insert_avatar($avatar = '', $id_or_email, $size = 96, $default = '', $alt = false) {
      $id = 0;
      if (is_numeric($id_or_email)) {
        $id = $id_or_email;
      } else if (is_string($id_or_email)) {
        $u = get_user_by('email', $id_or_email);
        $id = $u->id;
      } else if (is_object($id_or_email)) {
        $id = $id_or_email->user_id;
      if ($id == 0) return $avatar;
      $pic = get_user_meta($id, 'fb_profile_picture', true);
    if($pic) $avatar = "<img alt='fb_avatar' src='$pic' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
        return $avatar;  // this is the line i added
    if (!$pic || $pic == '') return $avatar;
      $avatar = preg_replace('/src=("|\').*?("|\')/i', 'src=\'' . $pic . '\'', $avatar);
      return $avatar;

    I see the same problem, but with Chrome as well. I have Chrome version 48.0.2564.116 m. I’m using WordPress 4.4.2 and Nextend FB Connect version 1.5.7

    Your change fixes it for me when using Chrome. I modified your fix slightly for clarity.

    I commented out the line shown below with // and then added the line just below it (which I took from your fix).

    // $avatar = preg_replace(‘/src=(“|\’).*?(“|\’)/i’, ‘src=\” . $pic . ‘\”, $avatar);
    $avatar = “<img alt=’fb_avatar’ src=’$pic’ class=’avatar avatar-{$size} photo’ height='{$size}’ width='{$size}’ />”;

    I left everything else the same. This allows the FB avatar to appear for me instead of the Gravatar avatar.

    Thanks very much.


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Avatar problem in Firefox (Works in Chrome)’ is closed to new replies.