You are here

function protected_node_unlock in Protected Node 7

Same name and namespace in other branches
  1. 6 protected_node.module \protected_node_unlock()
  2. 1.0.x protected_node.module \protected_node_unlock()

Give access to the current user to the specified protected node.

The duration of the lock is as expected starting now.

@param[in] $nid The node to unlock.

Return value

bool TRUE if the node gets unlocked.

1 call to protected_node_unlock()
protected_node_rules_action_unlock in protected_node_rules/protected_node_rules.rules.inc
Grant access rights to the node to the current user.

File

./protected_node.module, line 1386
Protected Node module.

Code

function protected_node_unlock($nid) {
  if (is_numeric($nid)) {

    // Make sure the node exists.
    $node = node_load($nid);
    if ($node->protected_node_is_protected) {
      if (isset($_SESSION['has_entered_global_password'])) {
        $_SESSION['_protected_node']['passwords']['global'] = REQUEST_TIME;
      }
      else {
        $_SESSION['_protected_node']['passwords'][$nid] = REQUEST_TIME;
      }
      return TRUE;
    }
  }
  return FALSE;
}