function views_handler_filter_views_published_or_roles_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_has_roles.inc, line 34 - Definition of views_handler_filter_views_published_or_roles_has_roles.
Class
- views_handler_filter_views_published_or_roles_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'], "{$table}.status = 1\n OR\n ({$table}.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0 AND ***VIEW_OWN_UNPUBLISHED_NODES*** = 1)\n OR\n ***BYPASS_NODE_ACCESS*** = 1\n OR\n ***CURRENT_USER*** IN (SELECT ur.uid FROM {users_roles} ur WHERE ur.rid IN (:roles))", array(
':roles' => $roles,
));
}