1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* User Stats IP address count by user.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* IP addresses by user count handler.
|
10
|
*/
|
11
|
class views_handler_sort_user_ip_count extends views_handler_sort {
|
12
|
function query() {
|
13
|
$this->ensure_my_table();
|
14
|
// We need another subquery here to extract DISTINCT values
|
15
|
$sql = "SELECT COUNT(usi.ip_address)
|
16
|
FROM (SELECT DISTINCT(uid), ip_address FROM {user_stats_ips}) usi
|
17
|
WHERE usi.uid = " . check_plain($this->table_alias) . ".uid";
|
18
|
$this->field_alias = $this->query->add_orderby(NULL, "(" . $sql . ")", $this->options['order'], $this->table_alias . '_' . $this->field);
|
19
|
}
|
20
|
}
|