You are here

function content_lock_node_view in Content locking (anti-concurrent editing) 7

Same name and namespace in other branches
  1. 7.3 content_lock.module \content_lock_node_view()
  2. 7.2 content_lock.module \content_lock_node_view()

Implement hook_node_view() to inform user if he's holding locks on other nodes.

Parameters

$node: The node being viewed.

$view_mode: The type of output being generated for the node.

$langcode: The language code of the user.

File

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

Code

function content_lock_node_view($node, $view_mode, $langcode) {
  global $user;
  static $messages_shown = FALSE;
  if ($view_mode != 'full' || !_content_lock_is_lockable_node($node)) {
    return;
  }
  if (!$messages_shown) {
    _content_lock_show_warnings();
    $messages_shown = TRUE;
  }
  if (empty($node->in_preview)) {

    /* Check if the user has pending locks and warn him. */
    content_lock_warn_pending_locks($user->uid);
  }
}