Tweaking Since Last Visit hack
I don’t use the JavaScript version of Alex King’s Since Last Visit hack/plugin because I don’t like to depend on JS. And I didn’t even get it working back when I tried it out
After keeping the comment referred to in my previous post I noticed that the targetted post was showing new comments. So, I added a requirement to the database query in function ak_new_comments: and comment_approved not like 'spam'
making it say
if (isset($ak_last_visit)) {
$last_visit = date(“Y-m-d H:i:s”, $ak_last_visit);
$comment_date = $wpdb->get_var(“SELECT MAX(comment_date)”
.”FROM $tablecomments ”
.”WHERE comment_post_ID = ‘$post_id’ and comment_approved not like ‘spam’”
);
if ($comment_date > $last_visit) {
echo $html;
}
}
around line 178. No more ghost comments.
(Database studies came in handy, yet again.)
Leave a Reply