{"id":191,"date":"2005-02-02T16:16:38","date_gmt":"2005-02-02T15:16:38","guid":{"rendered":"http:\/\/frenchfragfactory.net\/ozh\/archives\/2005\/01\/31\/auto-moderate-old-posts-plugin\/"},"modified":"2007-04-22T14:35:12","modified_gmt":"2007-04-22T12:35:12","slug":"wordpress-plugin-auto-moderate-comments","status":"publish","type":"post","link":"https:\/\/planetozh.com\/blog\/2005\/02\/wordpress-plugin-auto-moderate-comments\/","title":{"rendered":"WordPress Plugin : Auto Moderate Comments"},"content":{"rendered":"<div class=\"message\">When I wrote this plugin, in early 2005, spam fighting was harsh, time consuming and painful. A few months later came the almighty <a href=\"http:\/\/akismet.com\/\">Akismet<\/a>. Until further notice, I consider this plugin deprecated.<\/div>\n<p>A lot of people tend to close comments when a post gets old, either to avoid comments on old topics, or to avoid spam (since link spammers randomly target old posts). I think it is a bad habit, since it&#39;s very frustrating for a late visitor not to be able to write a comment, or ask a question, especially when the post has a &quot;technical&quot; flavor (about code or software, for example). Plus, plugins auto closing comments do it regardless of the <em>activity<\/em> on a post : there can be a discussion going on, but suddenly, because the post was written 15 days ago, discussion is shut off. Kind of rude.<\/p>\n<p>I think it would be better to auto <em>moderate<\/em>, not <em>close<\/em>, old posts. I also think it would be smarter to consider <strong>activity<\/strong> on a thread, i.e. date of last comment if applicable, or modification, rather than the date it was written.<\/p>\n<p>So I wrote a WordPress plugin : <strong>Auto Moderate Comments<\/strong><\/p>\n<p><!--more--><\/p>\n<h2>How it works<\/h2>\n<p>Once installed and activated (see below), here is what the plugin does when someone posts a comment (or a trackback) to determine if this is Old Stuff&reg; or not, and thus to accept the comment or send it to moderation queue :<\/p>\n<ul>\n<li>Compare today&#39;s date with date of last comment<\/li>\n<li>If no comments, compare today&#39;s date with post&#39;s modification date<\/li>\n<li>If never modified, compare today&#39;s date with writing date<\/li>\n<\/ul>\n<h2>Install<\/h2>\n<p>Get the plugin here :<\/p>\n<ul>\n<li><a href=\"http:\/\/planetozh.com\/download\/plugins\/wp_ozh_automoderate.txt\">wp_ozh_automoderate.txt<\/a> (right click &#038; save as wp_ozh_automoderate.php) <\/li>\n<li><a href=\"http:\/\/planetozh.com\/download\/plugins\/wp_ozh_automoderate.php\">wp_ozh_automoderate.php<\/a> (colorized html, copy &#038; paste into a blank file but don&#39;t download it : it&#39;s colorized html, not plain code)<\/li>\n<\/ul>\n<p>Put the file in your plugins directory (<em>yourblog<\/em>\/wp-content\/plugins\/) and activate it in the plugins admin interface.<\/p>\n<h2>Options and Tags<\/h2>\n<p>You can edit three variables at the beginning of the script, explained here with their default values<\/p>\n<p><strong>$ozh_moderate[&#39;max_age&#39;] = 15<\/strong><br \/>\nMaximum number of days since last activity to accept a comment, otherwise sent to moderation queue<\/p>\n<p><strong>$ozh_moderate[&#39;status_ok&#39;] = &quot;<\/strong><br \/>\nResult printed by the <em>template tag<\/em> <strong>wp_ozh_automoderate_status<\/strong> (see below) when a post is still considered active (i.e. there has been some activity in the last <em>$ozh_moderate[&#39;max_age&#39;]<\/em> days)<br \/>\nDefault to empty string, but you can still make it &quot;Your comment is welcome&quot; if you want to make things clearer.<\/p>\n<p><strong>$ozh_moderate[&#39;status_moderated&#39;] = &quot;Please Note : Old stuff here&#8230; Therefore your comment on this post will be moderated (i.e. don&#39;t submit twice !)&quot;;<\/strong><br \/>\nResult printed by the <em>template tag<\/em> <strong>wp_ozh_automoderate_status<\/strong> (see below) when a post is considered inactive (i.e. too old). I think it is a good thing to tell readers that their comment will be moderated.<\/p>\n<p>The plugin creates a new <em>template tag <\/em>:<\/p>\n<p><strong>&lt;?php wp_ozh_automoderate_status() ?&gt;<\/strong><br \/>\nYou can for example Insert this tag in the comments template file :<\/p>\n<ul>\n<li>WordPress 1.2 \/ 1.3 : <em>blogroot<\/em>\/wp-comments.php<\/li>\n<li>WordPress 1.5 : <em>blogroot<\/em>\/wp-content\/themes\/<em>yourtheme or default<\/em>\/comments.php<\/li>\n<\/ul>\n<p>You can also get the status of a post, instead of printing it. To do so, pass 0 (zero) as a parameter :<br \/>\n<strong>&lt;?php $status = wp_ozh_automoderate_status(0) ?&gt;<\/strong><\/p>\n<h2>Notes<\/h2>\n<p>Of course, use this plugin if, by default, you are not moderating comments and are accepting pingbacks and trackbacks (Discussion Options in the admin area, &quot;Allow link notifications from other Weblogs&quot; and &quot;Allow People to post comments&quot;)<\/p>\n<p>The plugin should not interfere with anti spam plugins. I am using Kitten&#39;s Spaminator here, and as far as I can see, all my plugin does regarding that matter is even catching a few spam that went through Spaminator.<\/p>\n<p>The plugin <em>should<\/em> work on all versions of WordPress. To be honest I tested it only with 1.3 and 1.5 and was too lazy to set up a third installation with 1.2, but I see no reason why it wouldn&#39;t fit in 1.2 as well :-)<br \/>\n(By the way, you should upgrade to 1.5, but that is another story :)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Don&#39;t close discussion. Just Auto Moderate old stuff.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[2,10,85,27,245],"class_list":["post-191","post","type-post","status-publish","format-standard","hentry","tag-code","tag-php","tag-plugins","tag-spam","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=191"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/191\/revisions"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/categories?post=191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/tags?post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}