Welcome, visitor! Log in
 

Source View: pre_comment_author_name

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
82       ('$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', '$comment_parent', '$user_id')
83       ");
84  
85       $id = $wpdb->insert_id;
86  
87       if ( $comment_approved == 1) {
88            $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'");
89            $wpdb->query( "UPDATE $wpdb->posts SET comment_count = $count WHERE ID = '$comment_post_ID'" );
90       }
91       return $id;
92  }
93  
94  function wp_filter_comment($commentdata) {
95       $commentdata['user_id']              = apply_filters('pre_user_id', $commentdata['user_ID']);
96       $commentdata['comment_agent']        = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']);
97       $commentdata['comment_author']       = apply_filters('pre_comment_author_name', $commentdata['comment_author']);
98       $commentdata['comment_content']      = apply_filters('pre_comment_content', $commentdata['comment_content']);
99       $commentdata['comment_author_IP']    = apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP']);
100       $commentdata['comment_author_url']   = apply_filters('pre_comment_author_url', $commentdata['comment_author_url']);
101       $commentdata['comment_author_email'] = apply_filters('pre_comment_author_email', $commentdata['comment_author_email']);
102       $commentdata['filtered'] = true;
103       return $commentdata;
104  }
105  
106  function wp_allow_comment($commentdata) {
107       global $wpdb;
108       extract($commentdata);
109  
110       $comment_user_domain = apply_filters('pre_comment_user_domain', gethostbyaddr($comment_author_IP) );
111  
112       // Simple duplicate check