{"id":288,"date":"2005-04-18T00:00:09","date_gmt":"2005-04-17T21:00:09","guid":{"rendered":"http:\/\/www.all-things-me.net\/blog\/archives\/2005\/04\/18\/tweaking-alex-kings-since-last-visit-hack"},"modified":"2005-04-28T23:33:14","modified_gmt":"2005-04-28T20:33:14","slug":"tweaking-since-last-visit-hack","status":"publish","type":"post","link":"https:\/\/www.all-things-me.net\/blog\/2005\/04\/18\/tweaking-since-last-visit-hack","title":{"rendered":"Tweaking Since Last Visit hack"},"content":{"rendered":"<p>I don&#8217;t use the <a href=\"http:\/\/www.alexking.org\/index.php?content=software\/wordpress\/wp-last_visit.php\">JavaScript version<\/a> of Alex King&#8217;s Since Last Visit hack\/plugin because I don&#8217;t like to depend on JS. And I didn&#8217;t even get it working back when I tried it out <img src=\"https:\/\/www.all-things-me.net\/blog\/wp-includes\/images\/smilies\/icon_lol.gif\" alt=\":laugh:\" class=\"wp-smiley\" style=\"height: 1em; max-height: 1em;\" \/><\/p>\n<p>After keeping the comment referred to in my <!--permalink:287: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: <code>and comment_approved not like 'spam'<\/code> making it say<\/p>\n<blockquote class=\"php\"><p>if (isset($ak_last_visit)) {<br \/>\n&nbsp;$last_visit = date(&#8220;Y-m-d H:i:s&#8221;, $ak_last_visit);<br \/>\n&nbsp;$comment_date = $wpdb->get_var(&#8220;SELECT MAX(comment_date)&#8221;<br \/>\n&nbsp;.&#8221;FROM $tablecomments &#8221;<br \/>\n&nbsp;.&#8221;WHERE comment_post_ID = &#8216;$post_id&#8217; <strong>and comment_approved not like &#8216;spam&#8217;<\/strong>&#8221;<br \/>\n&nbsp;);<br \/>\n&nbsp;if ($comment_date > $last_visit) {<br \/>\n&nbsp;&nbsp;echo $html;<br \/>\n&nbsp;}<br \/>\n}<\/p><\/blockquote>\n<p>around line 178. No more ghost comments.<\/p>\n<p>(Database studies came in handy, yet again.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I don&#8217;t use the JavaScript version of Alex King&#8217;s Since Last Visit hack\/plugin because I don&#8217;t like to depend on JS. And I didn&#8217;t even get it working back when I tried it out After keeping the comment referred to in my I noticed that the targetted post was showing new comments. So, I added [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,18],"tags":[],"class_list":["post-288","post","type-post","status-publish","format-standard","hentry","category-tweaks","category-wordpress"],"_links":{"self":[{"href":"https:\/\/www.all-things-me.net\/blog\/wp-json\/wp\/v2\/posts\/288","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.all-things-me.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.all-things-me.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.all-things-me.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.all-things-me.net\/blog\/wp-json\/wp\/v2\/comments?post=288"}],"version-history":[{"count":0,"href":"https:\/\/www.all-things-me.net\/blog\/wp-json\/wp\/v2\/posts\/288\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.all-things-me.net\/blog\/wp-json\/wp\/v2\/media?parent=288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.all-things-me.net\/blog\/wp-json\/wp\/v2\/categories?post=288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.all-things-me.net\/blog\/wp-json\/wp\/v2\/tags?post=288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}