You are here

function _access_unpublished_node_access in Access unpublished 6

Returns true if the user has 'view unpublished ??? content' or if they have the permission corresponding to the node's content type.

1 string reference to '_access_unpublished_node_access'
access_unpublished_menu_alter in ./access_unpublished.module
Implements hook_menu_alter().

File

./access_unpublished.module, line 146
This module is used to allow access to unpublished nodes

Code

function _access_unpublished_node_access($op, $node) {

  //Check if the node is not published.
  if ($node->status == 0) {

    //Check the permissions.
    if (user_access('Allow access to unpublished ' . $node->type . ' nodes if hash is provided')) {

      //Check if the hash value is correct.
      if ($_GET[_access_unpublished_get_querystring()] == _access_unpublished_get_hash($node->nid)) {

        //Allow for viewing of the unpublished node.
        return TRUE;
      }
    }
  }

  //If none of the above conditions were satisfied, then use normal node_access.
  return node_access('view', $node);
}