You are here

function protected_node_unlock in Protected Node 6

Same name and namespace in other branches
  1. 7 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

TRUE if the node gets unlocked.

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

File

./protected_node.module, line 988

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) {
      $_SESSION['_protected_node']['passwords'][$nid] = time();
      return TRUE;
    }
  }
  return FALSE;
}