function view_unpublished_handler_filter_node_status::query in view_unpublished 7
Same name and namespace in other branches
- 6 view_unpublished_handler_filter_node_status.inc \view_unpublished_handler_filter_node_status::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_node_status::query
File
- ./
view_unpublished_handler_filter_node_status.inc, line 13 - Provides integration with the Views module.
Class
- view_unpublished_handler_filter_node_status
- Filter by view all unpublished permissions granted by view_unpublished Takes over the Published or Admin filter query.
Code
function query() {
$table = $this
->ensure_my_table();
$where_per_type = array();
foreach (node_type_get_types() as $type => $name) {
$where_per_type[] = "({$table}.type = '{$type}' AND ***VIEWUNPUBLISHED_{$type}*** = 1)";
}
$where_per_type = implode(' OR ', $where_per_type);
$this->query
->add_where_expression($this->options['group'], "{$table}.status = 1 OR ({$table}.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0 AND ***VIEW_OWN_UNPUBLISHED_NODES*** = 1) OR ***ADMINISTER_NODES*** = 1 OR {$where_per_type}");
}