[lists] [wp-hackers] Duplicate Comments/Pings
Mark Jaquith
mark.wordpress at txfx.net
Fri Nov 19 10:19:45 UTC 2004
I'm talking about discarding the current ping or comment if it is an
exact duplicate of a previous ping or comment for the same entry only!
And by duplicate, I mean duplicate. Same IP, same content, same
everything. You could also set a time limit (say, within 10 minutes),
but that's not really necessary.
Example: (don't quote me, this isn't necessarily the exact code that
would be used)
> $query = "SELECT count(*) WHERE comment_post_ID = '$comment_post_id'
> AND comment_content = '$content' AND comment_author = '$author' AND
> comment_author_IP = '$ip' LIMIT 1;";
> $indentical = $wpdb->get_var($query);
> if ($identical){
> // dump the comment or trackback
> }
Elliott Bäck wrote:
> At that point it could very well be discarding three pings, or four
> pings, etc....and you'd have to set a time-threshold. How would you
> know what is enough?
>
> Mark Jaquith wrote:
>
>> Is there any reason that anyone knows of why WP doesn't discard
>> duplicate comments or trackbacks or pingbacks on the same entry?
>> Sometimes people hit "Post Comment" twice, or their blog software
>> sends two pings in a row. It would be really easy to check on
>> submission if the comment or trackback is a duplicate and discard it,
>> if it is. Can anyone think of a good reason not to do this?
>
More information about the hackers
mailing list