You are here

function content_lock_fetch_lock in Content locking (anti-concurrent editing) 7.2

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

Fetch the lock for a node.

Parameters

string $nid: A node id.

Return value

object The lock for the node. FALSE, if the document is not locked.

7 calls to content_lock_fetch_lock()
content_lock_node in ./content_lock.module
Try to lock a document for editing.
content_lock_node_lock_ctools_access_check in plugins/access/node_lock.inc
Checks if the node is locked.
content_lock_node_validate in ./content_lock.module
Implements hook_node_validate().
content_lock_release_item in ./content_lock.module
Menu callback.
content_lock_release_own_item in ./content_lock.module
Release the lock of a node.

... See full list

File

./content_lock.module, line 601
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();
}