[development] access control for periodicals - does my planmakesense?

Nedjo Rogers nedjo at islandnet.com
Sun Sep 24 01:01:57 UTC 2006


>> You could instead use the 'view' op in hook_access of the node type. As
>> with all ops of hook_access, it overrides what's in the node_access 
>> table.
>
> Yes, but only if I define the node type, which I prefer not to do.
> hook_access is only called for the module that defines the node.

True.

Another option would be to use a menu override in a module called after 
node.module. Something like:

/**
 * Implementation of hook_menu().
 */
function modulename_menu($may_cache) {
  $items = array();

  if ($may_cache) {
  }
  else {
    if (arg(0) == 'node' && is_numeric(arg(1))) {
      $node = node_load(arg(1));
      if ($node->nid) {
        if (your_test_here) {
          $items[] = array(
            'path' => 'node/'. arg(1),
            'title' => t('view'),
            'access' => FALSE
          );
      }
    }
  }
  return $items;
} 



More information about the development mailing list