function template_preprocess_profile_block

Process variables for profile-block.tpl.php.

The $variables array contains the following arguments:

  • $account
  • $fields

See also

profile-block.tpl.php

File

modules/profile/profile.module, line 541

Code

function template_preprocess_profile_block(&$variables) {
    $variables['user_picture'] = theme('user_picture', array(
        'account' => $variables['account'],
    ));
    $variables['profile'] = array();
    // Supply filtered version of $fields that have values.
    foreach ($variables['fields'] as $field) {
        if ($field->value) {
            $variables['profile'][$field->name] = new stdClass();
            $variables['profile'][$field->name]->title = check_plain($field->title);
            $variables['profile'][$field->name]->value = $field->value;
            $variables['profile'][$field->name]->type = $field->type;
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.