You are here

function og_handler_filter_group_roles::query in Organic groups 7

Adds in the the uid contraint for the membership table.

Overrides views_handler_filter_in_operator::query

File

includes/views/og_handler_filter_group_roles.inc, line 10

Class

og_handler_filter_group_roles
Filter handler for user roles

Code

function query() {
  parent::query();

  // If there is a users table present constraint the roles uid to match the
  // users table.
  // @todo: Make the used user relationship configurable and optional.
  foreach ($this->query->relationships as $alias => $info) {
    if ($info['table'] == 'users') {
      $user_table_alias = $alias;
      break;
    }
  }
  if (!empty($user_table_alias)) {
    $this->query
      ->add_where_expression(0, $this->table_alias . '.uid = ' . $user_table_alias . '.uid');
  }
}