You are here

views_handler_field_user_ip_count.inc in User Stats 7

Same filename and directory in other branches
  1. 6 views/views_handler_field_user_ip_count.inc

User Stats IP address count by user.

File

views/views_handler_field_user_ip_count.inc
View source
<?php

/**
 * @file
 * User Stats IP address count by user.
 */

/**
 * IP addresses by user count handler.
 */
class views_handler_field_user_ip_count extends views_handler_field_numeric {
  function query() {
    $this->table_alias = $this
      ->ensure_my_table();

    // We need another subquery here to extract DISTINCT values
    $sql = "SELECT COUNT(usi.ip_address)\n      FROM (SELECT DISTINCT(uid), ip_address FROM {user_stats_ips}) usi\n      WHERE usi.uid = " . check_plain($this->table_alias) . ".uid";
    $this->field_alias = $this->query
      ->add_field(NULL, "(" . $sql . ")", $this->table_alias . '_' . $this->field);
  }

}

Classes

Namesort descending Description
views_handler_field_user_ip_count IP addresses by user count handler.