howto: basic snippet to get a user's details into your tpl.php or template.php files
After installing Drupal for Facebook, it was easy enough to configure the module settings, but finding the relevant functions to do the simple things that i wanted took me a little longer as i couldn't find any documentation listing useful theming tools, or tutorials on the subject. Oh well, i hope this helps someone out there.
The module wasn't automatically pulling in profile pics the one place that i wanted them, alongside comments.
once i found the functions fb_get_object_fbu and fb_users_getInfo everything fell into place.
if you're curious, fb_get_object_fbu is on line 550 of fb.module and is described as:
"Convenience function to learn the fbu associated with a user, node or comment. Used in theming (X)FBML tags."
fb_users_getInfo is in the same file, on line 1004:
Helper function for facebook's users_getInfo API.
This function makes calls to users_getInfo more efficient, by caching
results in the session, so calls do not always require hitting Facebook's
servers.
@param $oids
Array of facebook object IDs. In this case they should each be a user id.
so, to do what i wanted, it was as simple as opening up comment.tpl.php and dropping this in where needed.
<?php
$fbu = fb_get_object_fbu( $comment );
if ( $fbu ) { $fbu_info = fb_users_getInfo( array( $fbu ) ); }
if( $fbu_info[0]['pic_square'] ) {
print '<img src="'. $fbu_info[0]['pic_square'] . '" />'; }
?>
"pic_square" being the mini profile pic provided by facebook.
I just want to say a huge thanks to the developers of this module for making it so easy for me to connect with fb!
- Forums:

Thanks, glad you shared
Thanks, glad you shared that.
However... It's not supposed to be that hard. The modules should, by default, change theme('user_picture'...) to do the right thing. For example on this site, I have not tweaked the theme as you describe, and you should see your profile pic next to your comments (unless you specifically upload another pic to your local account).
Same Issue
I am facing the same issue. I can see the bigger Facebook picture under Drupal user. But the smaller squire image is the Facebook default image (shadow image of a guy) same case in this site also....can you please help me to get the smaller facebook image next to the comments?
yeah, well it didn't for some
yeah, well it didn't for some reason, no harm done though.
I don't mind, i'm actually starting from scratch, without an existing user base, and I'm probably just going to roll with the info from facebook and not even let (force) users (to tediously) update their pics/signatures/profiles themselves.
i ended up rolling something closer to this as it fits better with the way things are written up in the zen theme:
<?php$fbu = fb_get_object_fbu( $comment );if( $fbu ) { $fbu_info = fb_users_getInfo( array( $fbu ) ); }if( is_array($fbu_info) && is_array($fbu_info[0]) && $fbu_info[0]['pic_square'] ) : ?>*img src="<?php echo $fbu_info[0]['pic_square']; ?>" /*<?php else : ?>*div class="spacer"**/div*<?php endif; ?>where i use the 'spacer' div to display a default profile pic, with a little css magic.
i'm a forum noob
kk, so i don't know how to format the text to stop the img tag on the last line of my code from getting stripped out.
it should be obvious what to do though, the variable $fbu_info[0]['pic_square'] contains the url to the image :)
This forum makes it way
This forum makes it way harder than it should be. I'll look into that. In the meantime, here's a closer approximation of your code.
$fbu = fb_get_object_fbu( $comment );
if ( $fbu ) {
$fbu_info = fb_users_getInfo( array( $fbu ) );
}
if( $fbu_info[0]['pic_square'] ) {
print '<img src="'. $fbu_info[0]['pic_square'] . '" />';
}