Newer
Older
The Great Git Migration
committed
<?php
/**
* Filter handler for the current user
*/
class views_handler_filter_user_current extends views_handler_filter_boolean_operator {
function construct() {
parent::construct();
$this->value_value = t('Is the logged in user');
}
function query() {
$this->ensure_my_table();
Daniel Wehner
committed
$field = $this->table_alias . '.' . $this->real_field . ' ';
$or = db_or();
The Great Git Migration
committed
if (empty($this->value)) {
Daniel Wehner
committed
$or->condition($field, '***CURRENT_USER***', '<>');
The Great Git Migration
committed
if ($this->accept_null) {
Daniel Wehner
committed
$or->isNull($field);
The Great Git Migration
committed
}
}
else {
Daniel Wehner
committed
$or->condition($field, '***CURRENT_USER***', '=');
The Great Git Migration
committed
}
Daniel Wehner
committed
$this->query->add_where($this->options['group'], $or);