home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (views_handler_filter_comment_user_uid.inc)

This example Drupal source code file (views_handler_filter_comment_user_uid.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

cid, class, condition, db_or, extends, function, php, query, subselect, views_handler_filter_comment_user_uid, views_handler_filter_user_name

The views_handler_filter_comment_user_uid.inc Drupal example source code

<?php
// $Id: views_handler_filter_comment_user_uid.inc,v 1.2.4.2 2009/11/13 12:36:06 dereine Exp $

/**
 * Filter handler to accept a user id to check for nodes that user posted or
 * commented on.
 */
class views_handler_filter_comment_user_uid extends views_handler_filter_user_name {
  function query() {
    $this->ensure_my_table();

    $subselect = db_select('comments', 'c');
    $subselect->addField('c', 'cid');
    $subselect->condition('uid', $this->value, $this->operator);
    $subselect->condition('nid', "$this->table_alias.nid");
    $subselect = $subselect->countQuery();

    $condition = db_or()
      ->condition("$this->table_alias.uid", $this->value, $this->operator)
      ->condition(0, $subselect, '<');

    $this->query->add_where(0, $condition);
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal views_handler_filter_comment_user_uid.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.