You are here

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

Same name and namespace in other branches
  1. 6.2 content_lock.module \content_lock_release()
  2. 7.3 content_lock.module \content_lock_release()
  3. 7 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.

5 calls to content_lock_release()
content_lock_nodeapi in ./content_lock.module
Implementation of hook_nodeapi().
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().
content_lock_timeout_nodeapi in modules/content_lock_timeout/content_lock_timeout.module
Implemention of hook_form_alter().

File

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

Code

function content_lock_release($nid, $uid = NULL) {
  $add_sql = '';
  $args = array(
    $nid,
  );
  if (isset($uid)) {
    $add_sql = " AND uid = %d";
    $args[] = $uid;
  }
  db_query("DELETE FROM {content_lock} WHERE nid = %d" . $add_sql, $args);
  module_invoke_all('content_lock_released', $nid);
}