You are here

function _domain_write_records in Domain Access 5

Store node_access records in the {domain_access{} table.

Parameters

$nid: The node id being acted upon.

$grants: The grants passed by hook_node_access_records().

1 call to _domain_write_records()
domain_nodeapi in ./domain.module
Implement hook_nodeapi().

File

./domain.module, line 941
Core module functions for the Domain Access suite.

Code

function _domain_write_records($nid, $grants = array()) {
  if ($nid > 0 && !empty($grants)) {
    db_query("DELETE FROM {domain_access} WHERE nid = %d", $nid);
    foreach ($grants as $grant) {
      db_query("INSERT INTO {domain_access} (nid, gid, realm) VALUES (%d, %d, '%s')", $nid, $grant['gid'], $grant['realm']);
    }
  }
}