function template_preprocess_user_picture
Same name and namespace in other branches
- 7.x drupal-7.x/modules/user/user.module \template_preprocess_user_picture()
Process variables for user-picture.tpl.php.
The $variables array contains the following arguments:
- $account
See also
Archivo
- drupal-6.x/
modules/ user/ user.module, line 837 - Enables the user registration and login system.
Código
function template_preprocess_user_picture(&$variables) {
$variables['picture'] = '';
if (variable_get('user_pictures', 0)) {
$account = $variables['account'];
if (!empty($account->picture) && file_exists($account->picture)) {
$picture = file_create_url($account->picture);
}
else if (variable_get('user_picture_default', '')) {
$picture = variable_get('user_picture_default', '');
}
if (isset($picture)) {
$alt = t("@user's picture", array('@user' => $account->name ? $account->name : variable_get('anonymous', t('Anonymous'))));
$variables['picture'] = theme('image', $picture, $alt, $alt, '', FALSE);
if (!empty($account->uid) && user_access('access user profiles')) {
$attributes = array(
'attributes' => array('title' => t('View user profile.')),
'html' => TRUE,
);
$variables['picture'] = l($variables['picture'], "user/$account->uid", $attributes);
}
}
}
}