function content_lock_fetch_lock in Content locking (anti-concurrent editing) 7
Same name and namespace in other branches
- 6.2 content_lock.module \content_lock_fetch_lock()
- 6 content_lock.module \content_lock_fetch_lock()
- 7.3 content_lock.module \content_lock_fetch_lock()
- 7.2 content_lock.module \content_lock_fetch_lock()
Fetch the lock for a node.
Parameters
$nid: A node id.
Return value
The lock for the node. FALSE, if the document is not locked.
6 calls to content_lock_fetch_lock()
- content_lock_node in ./
content_lock.module - Try to lock a document for editing.
- content_lock_node_validate in ./
content_lock.module - Implement hook_node_validate() to check that the user is maintaining his lock.
- 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_node_prepare in modules/
content_lock_timeout/ content_lock_timeout.module - Implemention of hook_form_alter().
File
- ./
content_lock.module, line 443 - Allows users to lock documents for modification.
Code
function content_lock_fetch_lock($nid) {
$query = db_select('content_lock', 'c')
->fields('c')
->condition('c.nid', $nid);
$u = $query
->leftJoin('users', 'u', '%alias.uid = c.uid');
$query
->fields($u, array(
'name',
));
return $query
->execute()
->fetchObject();
}