You are here

function userpoints_user_view in User Points 7

Same name and namespace in other branches
  1. 7.2 userpoints.module \userpoints_user_view()

Implements hook_user_view().

File

./userpoints.module, line 1233

Code

function userpoints_user_view($account, $view_mode) {
  global $user;
  if (user_access('view userpoints') || user_access('view own userpoints') && $user->uid == $account->uid) {
    $points_list = userpoints_get_points_list($account);
    if (!empty($details) || $points_list) {
      $account->content['userpoints'] = array(
        'title' => array(
          '#markup' => '<h3>' . t('!Points', userpoints_translation()) . '</h3>',
        ),
        '#weight' => 0,
      );
      if ($points_list) {
        $account->content['userpoints'] += $points_list;
      }
    }
  }
}