<?php /* This plugin automatically marks items as closed after a certain period of time. This prevents comment spammers from slipping in once you’re no longer likely to notice them. Install: 1. Unzip the file and upload the contents to your plugin directory. 2. Install the plugin through the nucleus admin area. Usage: Simply insert <%plugin(ExpiringComments)%> somewhere in your template (whichever template is used to display comments). I recommend the Item Header area. History: v1.0 - Initial release. v1.2 - Code cleaned up. - Added option to change expiry time Initial idea and release by: Mark Christian http://www.shinyplasticbag.com Updated by: Joseph McDermott http://www.faceh.com */ class NP_ExpiringComments extends NucleusPlugin { function getName() { return 'Expiring Comments'; } function getAuthor() { return 'Mark Christian, faceh'; } function getURL() { return 'http://www.shinyplasticbag.com'; } function getVersion() { return '1.2'; } function getDescription() { return 'Automatically disables comments on items after a set time.'; } function install() { $this->createOption('expiretime','After how many days should the item become closed?','text','7'); } function doTemplateVar(&$item) { $expiretime = $this->getOption('expiretime'); $expiretime = $expiretime*86400; if ($item->closed == '0' && (time() - $item->timestamp) > $expiretime) { mysql_query("update " . sql_table('item') . " set iclosed='1' where inumber='".$item->itemid."'"); } } } ?>