function _gravatar_load_account in Gravatar integration 7
Same name and namespace in other branches
- 6 gravatar.module \_gravatar_load_account()
1 call to _gravatar_load_account()
- gravatar_preprocess_user_picture in ./gravatar.module
- Override template_preprocess_user_picture() to display user pictures with
Gravatar integration.
File
- ./gravatar.module, line 202
- Integrates gravatar service for user pictures.
Code
function _gravatar_load_account($account) {
if (!empty($account->nid) || !empty($account->cid) || empty($account->roles)) {
$original_values = $account;
if (!isset($account->uid)) {
$account->uid = 0;
}
$account = $account->uid ? user_load($account->uid) : drupal_anonymous_user();
if (!$account->uid) {
$values = array_fill_keys(array(
'name',
'mail',
'homepage',
'hostname',
), '');
foreach ($values as $value => $default_value) {
if (empty($account->{$value})) {
$account->{$value} = !empty($original_values->{$value}) ? $original_values->{$value} : $default_value;
}
}
}
}
if (isset($account->picture) && is_numeric($account->picture)) {
$account->picture = file_load($account->picture);
}
return $account;
}