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