You are here

function views_handler_arg_uid_touch in Views (for Drupal 7) 5

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

File

modules/views_user.inc, line 274

Code

function views_handler_arg_uid_touch($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);
      $table_data = _views_get_tables();
      $joininfo = $table_data['comments']['join'];
      $joininfo['extra'] = array(
        'uid' => $uid,
      );
      $tblnum = $query
        ->add_table("comments", false, 1, $joininfo);
      $table = $query
        ->get_table_name('comments', $tblnum);
      $query
        ->set_distinct();

      // once you do this, there's just one node.
      $query
        ->add_where("node.uid = '%s' OR {$table}.uid = '%s'", $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);
  }
}