function node_access_example_node_insert

Implements hook_node_insert().

Insert a new access record when a node is created.

See also

nodeapi_example.module

Related topics

1 call to node_access_example_node_insert()
node_access_example_node_update in node_access_example/node_access_example.module
Implements hook_node_update().

File

node_access_example/node_access_example.module, line 431

Code

function node_access_example_node_insert($node) {
    if (isset($node->private)) {
        db_insert('node_access_example')->fields(array(
            'nid' => $node->nid,
            'private' => (int) $node->private,
        ))
            ->execute();
    }
    drupal_set_message(t('New node @nid was created and private=@private', array(
        '@nid' => $node->nid,
        '@private' => !empty($node->private) ? 1 : 0,
    )));
}