You are here

function access_unpublished_node_access in Access unpublished 7

Implements hook_node_access().

Return NODE_ACCESS_ALLOW if url hash matches reference hash. In other cases return NODE_ACCESS_IGNORE to allow other modules or the node_access table to control access.

File

./access_unpublished.module, line 84
Drupal module: Access unpublished.

Code

function access_unpublished_node_access($node, $op) {
  if ($op == 'view' && isset($node->nid) && $node->status == NODE_NOT_PUBLISHED) {

    // Check user permission.
    if (user_access('access unpublished view unpublished node')) {
      if (_access_unpublished_check_hash($node->nid)) {
        return NODE_ACCESS_ALLOW;
      }
    }
  }
  return NODE_ACCESS_IGNORE;
}