You are here

function content_lock_release in Content locking (anti-concurrent editing) 7

Same name and namespace in other branches
  1. 6.2 content_lock.module \content_lock_release()
  2. 6 content_lock.module \content_lock_release()
  3. 7.3 content_lock.module \content_lock_release()
  4. 7.2 content_lock.module \content_lock_release()

Release a locked node.

Parameters

$nid: The node id to release the edit lock for.

$uid: If set, verify that a lock belongs to this user prior to release.

6 calls to content_lock_release()
content_lock_node_delete in ./content_lock.module
Implement hook_node_delete() to remove references to deleted nodes from the lock tables.
content_lock_node_update in ./content_lock.module
Implement hook_node_update() to unlock a node after it's saved.
content_lock_release_item in ./content_lock.module
Menu callback; release a locked node for all users or a specific user.
content_lock_release_own_item in ./content_lock.module
Release the lock of a node. We are using the current users uid, so the user only can delete his own locks. We never fail, as if the lock does not exist, the node is unlocked anyway
content_lock_timeout_cron in modules/content_lock_timeout/content_lock_timeout.module
Implementation of hook_cron().

... See full list

File

./content_lock.module, line 551
Allows users to lock documents for modification.

Code

function content_lock_release($nid, $uid = NULL) {
  $query = db_delete('content_lock')
    ->condition('nid', $nid);
  if (!empty($uid)) {
    $query
      ->condition('uid', $uid);
  }
  $query
    ->execute();
  module_invoke_all('content_lock_released', $nid);
}