I am trying to show the facebook avatar through views. Right now I am using the fields User:Picture to try and display user's avatar's that fit into a certain category. However, no facebook avatar shows, just the default avatar. Anyone know how to display the facebook avatar through views?

Comments

tsi’s picture

Same here, subscribing.

karimb’s picture

subscribing

lodin’s picture

I added the fbconnect avatar by theming the user picture field. Probably not the best solution, but it works.

views-view-field--picture.tpl.php:

<?php
if($fbuid = _get_user_fbuid($row->users_uid)) {
  $size = variable_get('fbconnect_pic_size', 'square');
  $logo = variable_get('fbconnect_pic_logo', TRUE);
  $output1 = <<<PIC
      <div class="picture">
        <fb:profile-pic uid="$fbuid" linked="false" size="$size" facebook-logo="$logo"></fb:profile-pic>
      </div>
PIC;
  $output = $output1.$output;
}
print $output; 
?>
cerup’s picture

subscribing.

The facebook picture should be accessible like 'normal' pictures so that they can be used with things like profile imagecache and views http://drupal.org/project/imagecache_profiles

xurizaemon’s picture

@cerup: that's a nice idea, but I don't think FB actually want us to pull the user icons off their site. Is it even possible to retrieve the user's FB icon via means other than FBML?

cerup’s picture

I know gigya saves the images and therefore it works with views just like any picture in the database.

peter törnstrand’s picture

subscribing

eric constantinides’s picture

Thanks lodin, that little script worked wonders for me.

medenfield’s picture

Hi,

This is a great solution, IMHO, for a node-based view. However, it doesn't work for a user based view. If I get time, I will try to modify it for a user-based view.

medenfield’s picture

Modified slightly for a user-based view:

<?php
$viewsuser = user_load($row->uid); 
$userfbuid    = $viewsuser->fbuid;
if($userfbuid) {
  $size = variable_get('fbconnect_pic_size', 'square');
  $logo = variable_get('fbconnect_pic_logo', TRUE);
  $output1 = <<<PIC
      <div class="picture">
        <fb:profile-pic uid="$userfbuid" linked="false" size="$size" facebook-logo="$logo"></fb:profile-pic>
      </div>
PIC;
  $output = $output1;
}
print $output;
?>
vectoroc’s picture

Status: Active » Needs review

try last dev. It should work without theming

jazzdrive3’s picture

Yeah, ditto to see if we can get imagecache support. The sizes you can pull in just make things ugly.

ensignavenger’s picture

Needs support for ImageCache Profiles- the FB picture is way too large!

vectoroc’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

tom friedhof’s picture

Version: » 7.x-2.x-dev
Status: Closed (fixed) » Needs work
StatusFileSize
new3.49 KB

I've started a patch for this. I've basically exposed another field to views to get the Facebook image field in the views ui. This patch is a start, but I think we should really be taking over the the Users: Picture field via a hook_views_data_alter, rather than creating a whole other field.

Putting this patch up here in case it's useful for anyone else, and also just in case somebody wants to pick up where I left off.

Tom

muschpusch’s picture

@vectoroc: how is it fixed? Is patch #16 still needed? We should move the imagecache discussion to a seperate issue...

MikeDivine’s picture

Who is maintaining this module? Seems there are many bugs right now.