You are here

function nodeaccess_nodeapi in Nodeaccess 5

Same name and namespace in other branches
  1. 6.2 nodeaccess.module \nodeaccess_nodeapi()
  2. 6 nodeaccess.module \nodeaccess_nodeapi()

Implementation of hook_nodeapi().

File

./nodeaccess.module, line 570

Code

function nodeaccess_nodeapi(&$node, $op) {
  switch ($op) {
    case 'delete':

      // Deleting node, delete related permissions.
      db_query('DELETE FROM {nodeaccess} WHERE nid = %d', $node->nid);
      foreach (array(
        'uid',
        'rid',
        'author',
      ) as $type) {
        $realm = 'nodeaccess_' . $type;
        node_access_write_grants($node, array(), $realm);
      }
      break;
  }
}