Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_comment_user_domain

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
102      $commentdata['comment_author_email'] = apply_filters('pre_comment_author_email', $commentdata['comment_author_email']);
103      $commentdata['filtered'] = true;
104      return $commentdata;
105 }
106
107 function wp_allow_comment($commentdata) {
108      global $wpdb;
109      extract($commentdata);
110
111      $comment_user_domain = apply_filters('pre_comment_user_domain', gethostbyaddr($comment_author_IP) );
112
113      // Simple duplicate check
114      $dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND ( comment_author = '$comment_author' ";
115      if ( $comment_author_email )
116           $dupe .= "OR comment_author_email = '$comment_author_email' ";
117      $dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
118      if ( $wpdb->get_var($dupe) )
119           die( __('Duplicate comment detected; it looks as though you\'ve already said that!') );
120