function views_handler_filter_views_published_or_roles_current_user_has_roles::query in Views Published or Roles 7
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::query
File
- handlers/
views_handler_filter_views_published_or_roles_current_user_has_roles.inc, line 34 - Definition of views_handler_filter_views_published_or_roles_current_user_has_roles.
Class
- views_handler_filter_views_published_or_roles_current_user_has_roles
- Filter by published status and by role.
Code
function query() {
$table = $this
->ensure_my_table();
$table = 'node';
$roles = array_keys($this->value);
$this->query
->add_where_expression($this->options['group'], '***CURRENT_USER*** IN (SELECT ur.uid FROM {users_roles} ur WHERE ur.rid IN (:roles))', array(
':roles' => $roles,
));
}