|
|
Drupal example source code file (views_handler_filter_node_access.inc)
The views_handler_filter_node_access.inc Drupal example source code<?php // $Id: views_handler_filter_node_access.inc,v 1.2.4.2 2010/08/26 09:41:55 dereine Exp $ /** * Filter by node_access records. */ class views_handler_filter_node_access extends views_handler_filter { function admin_summary() { } function operator_form(&$form, &$form_state) { } function can_expose() { return FALSE; } /** * See _node_access_where_sql() for a non-views query based implementation. */ function query() { if (!user_access('administer nodes')) { $table = $this->ensure_my_table(); $grants = db_or(); foreach (node_access_grants('view') as $realm => $gids) { foreach ($gids as $gid) { $grants->condition(db_and() ->condition($table . '.gid', $gid) ->condition($table . '.realm', $realm) ); } } $this->query->add_where('AND', $grants); $this->query->add_where('AND', $table . '.grant_view', 1, '>='); } } } Other Drupal examples (source code examples)Here is a short list of links related to this Drupal views_handler_filter_node_access.inc source code file: |
"Drupal" is a registered trademark of Dries Buytaert.
my drupal tutorials and examples
Copyright
1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.
Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.