You are here

function protected_node_lock in Protected Node 7

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

Revoke access to the current used from the specified protected node.

The effect is immediate.

Note that the date is not checked so it is possible that the node was already locked and this function still returns TRUE (i.e. the lock release was out of date and thus the node was anyway not accessible.)

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

Return value

bool TRUE if the node gets unlocked.

1 call to protected_node_lock()
protected_node_rules_action_lock in protected_node_rules/protected_node_rules.rules.inc
Revoke any access right to the node from the current user.

File

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

Code

function protected_node_lock($nid) {
  if (is_numeric($nid) && isset($_SESSION['_protected_node']['passwords']['global'])) {
    unset($_SESSION['_protected_node']['passwords']['global']);
    return TRUE;
  }
  if (is_numeric($nid) && isset($_SESSION['_protected_node']['passwords'][$nid])) {
    unset($_SESSION['_protected_node']['passwords'][$nid]);
    return TRUE;
  }
  return FALSE;
}