You are here

function tca_views_query_alter in Token Content Access 7

Implements hook_views_query_alter().

File

tca_node/tca_node.module, line 156
Main module file for Token Content Access nodes module.

Code

function tca_views_query_alter(&$view, &$query) {

  // Alter all node queries to remove TCA protected nodes if user does not have
  // bypass access.
  if ($query->base_table == 'node' && !user_access('bypass tca_node')) {
    $query
      ->add_field('node', 'tca_active', 'tca_active');
    $query
      ->add_where_expression(0, "node.tca_active = '0' OR node.tca_active IS NULL");
  }
}