Drupal 7 – Render Facebook profile picture with Facebook Connect

Merry Christmas!

After enabled the Author Pane module, the user facebook profile picture could not be loaded for those Facebook logged in users. So i override the author-pane-user-picture.tpl.php as follow.

<?php
/**
 * @file
 * Default theme implementation to present an picture configured for the
 * user's account.
 *
 * Available variables:
 * - $picture: Image set by the user or the site's default.
 * - $account: Array of account information. Potentially unsafe. Be sure to
 *   check_plain() before use.
 * - $imagecache_used: TRUE if imagecache was used to size the picture.
 * - $picture_link_profile: $picture with link to the user profile page if
 *   the viewer has permission to view the user's profile page, otherwise FALSE.
 * 
 * Use $picture_link_profile instead of $picture if you want the picture to
 * link to the account profile page.
 */
?>

<?php if (!empty($picture)): ?>
  <div class="picture">
    <?php print $picture; ?>
  </div>
<?php else: ?>
  <div class="picture">
    <?php
      if (module_exists("fbconnect")) {
        $fbuid = _get_user_fbuid($account->uid);
        if (isset($fbuid)) {
          print theme('fbconnect_user_picture_override', array('fbuid' => $fbuid, 'account' => $account, 'size' => variable_get('fbconnect_pic_size', 'square'), ));
        }
      }
    ?>
  </div>
<?php endif; ?>

 

Done =)

Reference:

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.