You are here

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

Same name and namespace in other branches
  1. 6.2 content_lock.module \content_lock_release_own_item()
  2. 7.3 includes/content_lock.pages.inc \content_lock_release_own_item()
  3. 7 content_lock.module \content_lock_release_own_item()
  4. 7.2 content_lock.module \content_lock_release_own_item()

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

1 string reference to 'content_lock_release_own_item'
content_lock_menu in ./content_lock.module
Implementation of hook_menu().

File

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

Code

function content_lock_release_own_item($nid, $response = true) {
  global $user;
  if ($nid != NULL) {
    content_lock_release($nid, $user->uid);

    // drupal_get_messages();
    if ($response) {
      drupal_goto("node/{$nid}");
    }
    else {
      exit;
    }
  }
  else {

    // thats what we do, if a user was creating a node and canceled
    if ($response) {
      drupal_goto();
    }
    else {
      exit;
    }
  }
}