You are here

function visitors_block_show_unique_visitors in Visitors 7

Same name and namespace in other branches
  1. 8 visitors.block.inc \visitors_block_show_unique_visitors()
  2. 7.2 visitors.block.inc \visitors_block_show_unique_visitors()
  3. 7.0 visitors.block.inc \visitors_block_show_unique_visitors()

Display unique visitors count to visitors block.

Parameters

$list_items: array associative array of variables, use for theme function

1 call to visitors_block_show_unique_visitors()
theme_visitors_block_view in ./visitors.block.inc
Implement a theme function for block output.

File

./visitors.block.inc, line 70
Display current visitor block.

Code

function visitors_block_show_unique_visitors(&$list_items) {
  if (variable_get('visitors_show_unique_visitor', 1)) {
    $query = 'SELECT COUNT(DISTINCT visitors_ip) FROM {visitors}';
    $unique_visitors = db_query($query)
      ->fetchField();
    $list_items[] = sprintf('%s: %u', t('Unique Visitors'), $unique_visitors);
  }
}