WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is ther a way of displaying the facebook profile picture in the WP-FB AutoConnect widget?

Like the bbPress login widget:

enter image description here

The WP-FB AutoConnect widget doesn't show it (I think it is like this by default):

enter image description here

(I'm using the latest version of the plugin + Wordpress 3.1 + bbpress plugin (also the latest version).

share|improve this question
up vote 1 down vote accepted

Hi JanoChen,

WP-FP-AutoConnect create a function that gets the Facebook Profile image and outputs it as an avatar.

The function is jfb_wp_avatar and it can be added to your template.

You have to enable the option in the plugin settings.

Here is how the function is defined in the plugin:

  * Optionally replace WORDPRESS avatars with FACEBOOK profile pictures
if( get_option($opt_jfb_wp_avatars) ) add_filter('get_avatar', 'jfb_wp_avatar', 10, 5);
function jfb_wp_avatar($avatar, $id_or_email, $size, $default, $alt)
    //First, get the userid
    if (is_numeric($id_or_email))       
        $user_id = $id_or_email;
    else if(is_object($id_or_email) && !empty($id_or_email->user_id))
       $user_id = $id_or_email->user_id;
    else if(is_string($id_or_email))
       $user_id = get_user_by('email', $id_or_email ); 

    //If we couldn't get the userID, just return default behavior (email-based gravatar, etc)
    if(!isset($user_id) || !$user_id) return $avatar;

    //Now that we have a userID, let's see if we have their facebook profile pic stored in usermeta
    $fb_img = get_usermeta($user_id, 'facebook_avatar_thumb');

    //If so, replace the avatar! Otherwise, fallback on what WP core already gave us.
    if($fb_img) $avatar = "<img alt='fb_avatar' src='$fb_img' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
    return $avatar;
share|improve this answer
How do you exactly call this function again? I tried <?php echo jfb_wp_avatar(); ?> and <?php echo jfb_wp_avatar($avatar, $id_or_email, $size, $default, $alt); ?>, but doesn't work. – James Forbes Sep 23 '11 at 8:13

Check the plugin's settings or the widget settings. The page of WP-FB AutoConnect in the official WordPress plugin directory says:

Facebook profile pictures can be used as avatars, even on pre-existing comments.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.