Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: comment_post

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
511      $approved = apply_filters('pre_comment_approved', $approved);
512
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      ");
518
519      $comment_id = $wpdb->insert_id;
520      do_action('comment_post', $comment_id, $approved);
521
522      if ( 'spam' !== $approved ) { // If it's spam save it silently for later crunching
523           if ( '0' == $approved )
524                wp_notify_moderator($comment_id);
525      
526           if ( get_settings('comments_notify') && $approved )
527                wp_notify_postauthor($comment_id, $comment_type);
528      }
529