~spreadubuntu/spreadubuntu/devel-drupal6

« back to all changes in this revision

Viewing changes to modules/views/modules/comment/views_handler_filter_comment_user_uid.inc

  • Committer: ruben
  • Date: 2009-06-08 09:38:49 UTC
  • Revision ID: ruben@captive-20090608093849-s1qtsyctv2vwp1x1
SpreadUbuntu moving to Drupal6. Based on ubuntu-drupal theme and adding our modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
// $Id: views_handler_filter_comment_user_uid.inc,v 1.1 2009/02/06 21:13:04 merlinofchaos Exp $
 
3
 
 
4
/**
 
5
 * Filter handler to accept a user id to check for nodes that user posted or
 
6
 * commented on.
 
7
 */
 
8
class views_handler_filter_comment_user_uid extends views_handler_filter_user_name {
 
9
  function query() {
 
10
    $this->ensure_my_table();
 
11
    $replace = array_fill(0, sizeof($this->value), '%d');
 
12
    $condition = $this->operator . ' (' . implode(", ", $replace) . ')';
 
13
 
 
14
    // We include the WHERE condition twice in the query, so we need two
 
15
    // copies of these argument values.
 
16
    $args = array_values($this->value);
 
17
    $args = array_merge($args, $args);
 
18
 
 
19
    $this->query->add_where($this->options['group'], "$this->table_alias.uid " . $condition . " OR
 
20
      (SELECT COUNT(*) FROM {comments} c WHERE c.uid " . $condition . " AND c.nid = $this->table_alias.nid)",
 
21
      $args);
 
22
  }
 
23
}