WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#12431 new enhancement

Record comment meta in wp_new_comment

Reported by: tellyworth Owned by:
Priority: normal Milestone: Future Release
Component: Comments Version: 3.0
Severity: normal Keywords: has-patch
Cc: has-patch

Description

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.

Attachments (1)

preprocess-comment-meta-r13514.patch (695 bytes) - added by tellyworth 3 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 Denis-de-Bernardy3 years ago

  • Milestone changed from Unassigned to 3.1

comment:2 nacin3 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Triage to Future Release
Note: See TracTickets for help on using tickets.