function internal_nodes_menu_get_item_alter in Internal Nodes 7
Implements hook_menu_get_item_alter().
File
- ./
internal_nodes.module, line 101 - Internal nodes
Code
function internal_nodes_menu_get_item_alter(&$router_item, $path, $original_map) {
// If loading a node.
if ($router_item['path'] == 'node/%') {
$nid = arg(1);
// If node exists.
if ($node = node_load($nid)) {
// If action is 404.
if ($node->internal_nodes['action'] == INTERNAL_NODES_NOT_FOUND) {
// If user doesn't have access.
if (!user_access('access ' . $node->type . ' node view')) {
// Change the load function - this makes Drupal really think the node doesn't exist.
$router_item['load_functions'] = serialize(array(
1 => 'internal_nodes_force_404',
));
}
}
}
}
}