1 node_access_example.module | node_access_example_node_insert($node) |
Implements hook_node_insert().
Insert a new access record when a node is created.
See also
nodeapi_example.module
Related topics
File
- modules/
examples/ node_access_example/ node_access_example.module, line 416 - Hook implementations for the Node Access Example module.
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();
}
backdrop_set_message(t('New node @nid was created and private=@private', array('@nid' => $node->nid, '@private' => !empty($node->private) ? 1 : 0)));
}