« Subtle spam Too much excitement II »

Tweaking Since Last Visit hack

:: Monday, Apr 18th 2005 @ 0:00 :: Tweaks, WordPress ::

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 :laugh:

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.)

No Comments

RSS feed for comments on this post.

No comments yet.

Sorry, the comment form is closed at this time. You can leave a comment here