You are here

function edit_limit_node_update in Edit Limit 7

Implements hook_node_update().

File

./edit_limit.module, line 227
edit_limit.module Primary module file for Edit Limit. This contains all the hooks needed to run the module.

Code

function edit_limit_node_update($node) {
  if (variable_get('edit_limit_node_count_enabled', FALSE)) {

    // Update the count of edit limits.
    $count_data = db_select('edit_limit_node_count', 'e')
      ->fields('e')
      ->condition('nid', $node->nid, '=')
      ->execute()
      ->fetchAssoc();
    $edit_count = 0;
    $update = array();
    if (!empty($count_data)) {
      $edit_count = $count_data['count'];
      $update = array(
        'nid',
      );
    }
    $edit_count++;
    $data = array(
      'nid' => $node->nid,
      'count' => $edit_count,
    );
    drupal_write_record('edit_limit_node_count', $data, $update);
  }
}