You are here

function views_handler_arg_uid in Views (for Drupal 7) 5

1 string reference to 'views_handler_arg_uid'
user_views_arguments in modules/views_user.inc

File

modules/views_user.inc, line 246

Code

function views_handler_arg_uid($op, &$query, $argtype, $arg = '') {
  switch ($op) {
    case 'summary':
      $query
        ->add_table('users', true);
      $query
        ->add_field('name', 'users');
      $query
        ->add_field('uid', 'users');
      $fieldinfo['field'] = "users.name";
      return $fieldinfo;
      break;
    case 'sort':
      $query
        ->add_orderby('users', 'name', $argtype);
      break;
    case 'filter':
      $uid = intval($arg);
      $query
        ->add_where("node.uid = {$uid}");
      break;
    case 'link':
      $name = $query->name ? $query->name : variable_get('anonymous', 'Anonymous');
      return l($name, "{$arg}/" . intval($query->uid));
    case 'title':
      if (!$query) {
        return variable_get('anonymous', 'Anonymous');
      }
      $user = db_fetch_object(db_query("SELECT name FROM {users} WHERE uid = '%d'", $query));
      return check_plain($user->name);
  }
}