Archive for January 18th, 2005
the ultimate comment idea
January 18th, 2005
i really like skippy’s self comment moderation plugin.
The basic idea is that if the user supplies a valid email address, and they check that email account, then the commenter is most likely not a spammer.
altho not foolproof, i like it better than asking people entering a certain code. plus this way it does not only fight spam, it also fights flamers. because from my personal experience, most flamers are too chicken **** to leave their real email addresses. this way i don’t need to waste my time to read their worthless comments.
i think it’s kinda annoying to ask your regular commenters repeatedly moderate their own comments. so i added a little modification where your script tests if the commenter’s email already exists in the database or not. if it does, it will be automatically approved, otherwise an email with an approval link is sent to the user.
i also thought of the idea to apply skippy’s filter only after a post is certain days old.
you are welcome to use either or both.
How to use my trick:
1. install skippy’s plugin. modify your $seed variable. activate it. upload moderation.php to your wp root directory.
2. make sure in your wp control panel, under options -> discussion “An administrator must approve the comment (regardless of any matches below)” is UNCHECKED.
3. open wp-comments-post.php and find the line:
$wpdb->query("INSERT INTO $tablecomments
if you wish to use auto unapprove comments after the post is __ many days old. add above
//// Auto unapprove comments if a post is ___ days old $how_old = 7; // 7 days $current_time = time(); $post_date = $wpdb->get_var("SELECT post_date FROM $tableposts WHERE ID='$comment_post_ID'"); $post_time = mysql2date('U', $post_date) + $how_old * 24 * 3600; if($post_time < $current_time && $approved == 1) { $approved = 0; } //// End unapprove comments if a post is ___ days old
if you wish to use auto unapprove comments if the commenter’s email addy is new. add above
//// Auto unapprove comments if the commenter's email is not recognized from the database $comment_author_email_exist = $wpdb->get_var("SELECT comment_author_email FROM $tablecomments WHERE comment_author_email='$email' AND comment_approved='1' LIMIT 1"); if(empty($comment_author_email_exist) && $approved == 1) { $approved = 0; } //// End unapprove comments if the commenter's email is not recognized from the database

