You are here

public function reviews_handler_field_username::render in Reviews 7

Render.

Overrides views_handler_field::render

File

views/reviews_handler_field_username.inc, line 18

Class

reviews_handler_field_username
Custom handler for reviews.

Code

public function render($values) {
  $uid = $values->reviews_uid;
  $result = db_select('users', 'u')
    ->fields('u', array(
    'name',
  ))
    ->condition('uid', $uid, '=')
    ->execute()
    ->fetchAll();
  if (count($result) != 0) {
    return $result[0]->name;
  }
  else {
    return t('Anonymous');
  }
}