You are here

function views_handler_filter_user_relationships_requester_or_requestee_current_user::query in User Relationships 7

Same name and namespace in other branches
  1. 6 user_relationship_views/views_handler_filter_user_relationships_requester_or_requestee_current_user.inc \views_handler_filter_user_relationships_requester_or_requestee_current_user::query()

Add this filter to the query.

Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.

Overrides views_handler_filter_boolean_operator::query

File

user_relationship_views/views_handler_filter_user_relationships_requester_or_requestee_current_user.inc, line 14
Filter handler for the current user @author pedrofaria http://drupal.org/user/27805

Class

views_handler_filter_user_relationships_requester_or_requestee_current_user
@file Filter handler for the current user @author pedrofaria http://drupal.org/user/27805

Code

function query() {
  $this
    ->ensure_my_table();
  $op = empty($this->value) ? '<>' : '=';
  $where = "({$this->table_alias}.requester_id {$op} ***CURRENT_USER*** OR {$this->table_alias}.requestee_id {$op} ***CURRENT_USER***)";
  $this->query
    ->add_where_expression($this->options['group'], $where);
}