You are here

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

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

Implements hook_node_view().

File

./content_lock.module, line 570

Code

function content_lock_node_view($node, $view_mode, $langcode) {
  global $user;
  static $messages_shown = FALSE;

  // Load module inc file.
  module_load_include('inc', 'content_lock', 'includes/content_lock.func');
  if ($view_mode != 'full' || !content_lock_is_lockable($node)) {
    return;
  }

  // Preview mode.
  if (!empty($node->in_preview)) {
    return;
  }
  if (!$messages_shown) {
    _content_lock_show_warnings();
    $messages_shown = TRUE;
  }

  // Check if the user has pending locks and send message.
  _content_lock_show_warnings_pending($user->uid);
}