[wp-trac] [WordPress Trac] #12431: Record comment meta in wp_new_comment

WordPress Trac wp-trac at lists.automattic.com
Sun Feb 28 21:29:43 UTC 2010


#12431: Record comment meta in wp_new_comment
-------------------------+--------------------------------------------------
 Reporter:  tellyworth   |       Owner:            
     Type:  enhancement  |      Status:  new       
 Priority:  normal       |   Milestone:  Unassigned
Component:  Comments     |     Version:  3.0       
 Severity:  normal       |    Keywords:            
-------------------------+--------------------------------------------------
 Spam filter plugins usually trigger on the preprocess_comment filter,
 which obviously happens prior to storing the comment (and thus prior to
 knowing comment_ID).

 Comment meta would be ideal for storing spam status information, but since
 the comment_ID isn't known at that point, doing so involves jumping
 through some hoops.

 This patch provides a simple way for spam filters to include comment
 metadata from preprocess_comment.  They simply include values in a
 'comment_meta' array like this:

 {{{
 add_action('preprocess_comment', 'my_spam_handler');

 function my_spam_handler($comment) {
     $comment['comment_meta']['my_spam_status'] = 'not-spam';
     return $comment;
 }
 }}}

 Each key/value pair in the comment_meta array is stored as comment
 metadata.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12431>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list