Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_comment_approved

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
502      } else {
503           if ( check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) )
504                $approved = 1;
505           else
506                $approved = 0;
507           if ( wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) )
508                $approved = 'spam';
509      }
511      $approved = apply_filters('pre_comment_approved', $approved);
513      $result = $wpdb->query("INSERT INTO $wpdb->comments 
514      (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, user_id)
515      VALUES 
516      ('$comment_post_ID', '$author', '$email', '$url', '$user_ip', '$now', '$now_gmt', '$comment', '$approved', '$user_agent', '$comment_type', '$user_id')
517      ");
519      $comment_id = $wpdb->insert_id;
520      do_action('comment_post', $comment_id, $approved);