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
205           // Everyone else's comments will be checked.
206           if ( check_comment($comment_author, $comment_author_email, $comment_author_url, $comment_content, $comment_author_IP, $comment_agent, $comment_type) )
207                $approved = 1;
208           else
209                $approved = 0;
210           if ( wp_blacklist_check($comment_author, $comment_author_email, $comment_author_url, $comment_content, $comment_author_IP, $comment_agent) )
211                $approved = 'spam';
212      }
213
214      $approved = apply_filters('pre_comment_approved', $approved);
215      return $approved;
216 }
217
218 function check_comment_flood_db( $ip, $email, $date ) {
219      global $wpdb;
220      if ( $lasttime = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = '$ip' OR comment_author_email = '$email' ORDER BY comment_date DESC LIMIT 1") ) {
221           $time_lastcomment = mysql2date('U', $lasttime);
222           $time_newcomment  = mysql2date('U', $date);
223           $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment);