function content_lock_release_item in Content locking (anti-concurrent editing) 7
Same name and namespace in other branches
- 6.2 content_lock.module \content_lock_release_item()
- 6 content_lock.module \content_lock_release_item()
- 7.3 includes/content_lock.pages.inc \content_lock_release_item()
- 7.2 content_lock.module \content_lock_release_item()
Menu callback; release a locked node for all users or a specific user.
Parameters
$nid: A node id.
$account: A user object. If passed, the lock will only be released if this user owned it.
Return value
This function will execute a redirect and doesn't return.
1 string reference to 'content_lock_release_item'
- content_lock_menu in ./
content_lock.module - Implementation of hook_menu().
File
- ./
content_lock.module, line 634 - Allows users to lock documents for modification.
Code
function content_lock_release_item($nid, $account = NULL) {
global $user;
if (empty($_GET['token']) || !drupal_valid_token($_GET['token'], "content_lock/release/{$nid}")) {
return MENU_ACCESS_DENIED;
}
if (!$account && _content_lock_verbose()) {
/*
* Enable our "lock released" message to inform the user who
* likely owned the lock which is to be broken.
*/
$lock = content_lock_fetch_lock($nid);
}
content_lock_release($nid, $account ? $account->uid : NULL);
if (_content_lock_verbose()) {
if (!empty($lock) && !$account && $user->uid != $lock->uid) {
$lock_account = user_load($lock->uid);
drupal_set_message(t('The editing lock held by !user has been released.', array(
'!user' => theme('username', array(
'account' => $lock_account,
)),
)), 'status', FALSE);
}
else {
drupal_set_message(t('The editing lock has been released.'), 'status', FALSE);
}
}
drupal_goto($account ? "user/{$account->uid}/content_lock" : 'admin/content/content_lock');
}