function node_access_example_node_load in Examples for Developers 7
Implements hook_node_load().
Gather and add the private setting for the nodes Drupal is loading.
See also
Related topics
File
- node_access_example/
node_access_example.module, line 406 - Module file illustrating API-based node access.
Code
function node_access_example_node_load($nodes, $types) {
$result = db_query('SELECT nid, private FROM {node_access_example} WHERE nid IN(:nids)', array(
':nids' => array_keys($nodes),
));
foreach ($result as $record) {
$nodes[$record->nid]->private = $record->private;
}
}