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
1329      $commentdata['comment_date']     = current_time('mysql');
1330      $commentdata['comment_date_gmt'] = current_time('mysql', 1);
1331
1332      $commentdata = wp_filter_comment($commentdata);
1333
1334      $commentdata['comment_approved'] = wp_allow_comment($commentdata);
1335
1336      $comment_ID = wp_insert_comment($commentdata);
1337
1338      do_action('comment_post', $comment_ID, $commentdata['comment_approved']);
1339
1340      if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching
1341           if ( '0' == $commentdata['comment_approved'] )
1342                wp_notify_moderator($comment_ID);
1343
1344           $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
1345
1346           if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) )
1347                wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' );