function fb_user_preprocess_user_picture in Drupal for Facebook 7.4
Implements hook_preprocess_HOOK().
File
- ./
fb_user.module, line 85 - This module manages relations between local Drupal user accounts and their accounts on facebook.com.
Code
function fb_user_preprocess_user_picture(&$vars, $hook) {
if (variable_get('user_pictures', 0) && $vars['account']->uid && empty($vars['account']->picture)) {
if (!isset($vars['account']->fbu)) {
// @todo move query to helper function
$result = db_query('SELECT fbu FROM {fb_user} WHERE uid=:uid', array(
':uid' => $vars['account']->uid,
));
$vars['account']->fbu = $result
->fetchField();
}
if (!empty($vars['account']->fbu)) {
$vars['account']->picture = (object) array(
'uri' => '//graph.facebook.com/' . $vars['account']->fbu . '/picture',
);
// Now that we've provided a picture url, we still need to markup the image.
template_preprocess_user_picture($vars);
}
}
}