You are here

function user_stats_node_insert in User Stats 7

Implements hook_node_insert().

File

./user_stats.module, line 291
User Stats provides commonly requested user statistics for themers. These are:

Code

function user_stats_node_insert($node) {
  $post_count_content_types = variable_get('user_stats_included_content_types', array());
  if ((empty($post_count_content_types) || in_array($node->type, $post_count_content_types)) && variable_get('user_stats_count_posts', TRUE)) {
    if ($node->status) {
      user_stats_post_count_update('increment', $node->uid);
    }
  }

  // Do IP Address update.
  global $user;

  // User IP addresses are only interesting if they are posting the content.
  if ($node->uid == $user->uid) {
    user_stats_ip_address_update($user->uid, ip_address());
  }
}