Welcome, visitor! Log in
 

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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

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
389      $commentdata['comment_date']     = current_time('mysql');
390      $commentdata['comment_date_gmt'] = current_time('mysql', 1);
391
392      $commentdata = wp_filter_comment($commentdata);
393
394      $commentdata['comment_approved'] = wp_allow_comment($commentdata);
395
396      $comment_ID = wp_insert_comment($commentdata);
397
398      do_action('comment_post', $comment_ID, $commentdata['comment_approved']);
399
400      if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching
401           if ( '0' == $commentdata['comment_approved'] )
402                wp_notify_moderator($comment_ID);
403
404           $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
405
406           if ( get_option('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_ID'] )
407                wp_notify_postauthor($comment_ID, $commentdata['comment_type']);