geeky · wp hacks

more for the ultimate comment idea

in addition to the previous post, i wrote a piece of code where you can add above

$wpdb->query("INSERT INTO $tablecomments

in your wp-comments-post.php to have it delete unapproved comments that’s ___ days old

//// Auto delete unapprove comments if the comment is ___ days old 
$how_old_comment = 10; // 10 days 
$current_time = time(); 
$comment_date = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_approved='0'"); 
$comment_time = mysql2date('U', $comment_date) + $how_old_comment * 24 * 3600; 
if($comment_time < $current_time) { // delete the comment 
$wpdb->query("DELETE FROM $tablecomments WHERE comment_approved='0' AND comment_date='$comment_date'"); 
} //// End delete unapprove comments if the comment is ___ days old

i haven’t thoroughly tested this code. if you have problems, let me know.

also here’s a script you can run to get rid of blank and/or invalid email addresses in your comments table. get the code here, paste it to a text file. modify the $default_email variable and name it dodos_update_blank_emails.php. then upload the script to your wp root directory and run it. do it at your own risk. i have tested it on my own site and it worked for me.

2 thoughts on “more for the ultimate comment idea

  1. Hey. I have a desktop cam similiar to yours. And I was curious how you get it online for others to view. I used to have it, years ago, but have seemed to forgot.

    If you could IM me on AIM: te amour xx. That’d be great. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s