You are here

function user_stats_comment_insert in User Stats 7

Implements hook_comment_insert().

File

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

Code

function user_stats_comment_insert($comment) {
  if (variable_get('user_stats_count_comments', TRUE)) {
    if ($comment->uid == NULL) {
      $comment->uid = 0;
    }
    $post_count_content_types = variable_get('user_stats_included_content_types', array());
    $node = node_load($comment->nid);
    if (empty($post_count_content_types) || in_array($node->type, $post_count_content_types)) {
      if ($comment->status == COMMENT_PUBLISHED) {
        user_stats_post_count_update('increment', $comment->uid);
      }
    }
  }
  global $user;

  // User IP addresses are only interesting if they are posting the content.
  if (TRUE && $comment->uid == $user->uid) {

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