You are here

function activity_db_rewrite_sql in Activity 6.2

Implementation of hook_db_rewrite_sql().

File

./activity.module, line 813
Primarily Drupal hooks and global API functions to manipulate activity.

Code

function activity_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
  if ($primary_field == 'aid' && count(module_implements('node_grants'))) {

    // add in node_access stuff here
    $node_access = _node_access_where_sql();
    if (!empty($node_access)) {
      $return['join'] = " LEFT JOIN {node_access} na ON na.nid = {$primary_table}.nid";
      $return['where'] = "({$primary_table}.nid IS NULL OR (" . $node_access . "))";
    }
    return $return;
  }
}