You are here

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

Same name and namespace in other branches
  1. 6.2 content_lock.module \_content_lock_show_warnings()
  2. 6 content_lock.module \_content_lock_show_warnings()
  3. 7.3 includes/content_lock.func.inc \_content_lock_show_warnings()
  4. 7.2 content_lock.module \_content_lock_show_warnings()
1 call to _content_lock_show_warnings()
content_lock_node_view in ./content_lock.module
Implement hook_node_view() to inform user if he's holding locks on other nodes.

File

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

Code

function _content_lock_show_warnings() {
  global $user;
  if (empty($_SESSION['content_lock'])) {
    return;
  }
  $data = unserialize($_SESSION['content_lock']);
  if (!is_array($data) || count($data) == 0) {
    return;
  }
  foreach ($data as $nid => $messsage) {
    if (_content_lock_still_locked($user->uid, $nid) > 0) {
      drupal_set_message($messsage, 'warning', FALSE);
    }
  }
  $_SESSION['content_lock'] = '';
}