Hi andyl56,

This project was on the back burner and I've just come back to it, to find I can't make the module work as I'd expected.

I receive notification emails ok, but the node is not unpublished once it expires. I had my settings set to:
Automatic unpublishing = One day
E-mail notification = Yes, and every day
Default email content
Per node = Enabled, Expire on Date, Expiration Date = +1 days [set for testing purposes]

As said, I receive the emails ok but the node remains published.

Please let me know what information I should send to make this error easier to track down and fix!

Thanks

Comments

astoltz’s picture

This node relies on the CRON feature of Drupal to handle most of the features. You can ensure through the status report page in Drupal whether or not this is properly running. It should run ideally once every hour. There's also a manual run link on that page to help test that out.

pnc999’s picture

Thanks andyl56,

My cron runs daily at the moment but I ran the manual cron and got the following:

user warning: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(NOW(), expire) >= 0 AND expiremode != "none"' at line 1 query: SELECT nid FROM node_expire WHERE DATEDIFF(NOW(), expire) >= 0 AND expiremode != "none" in E:\Inetpub\wwwroot\***\***\includes\database.mysql.inc on line 172.

(The asterixes just replace the names of my directories)

My node_expire table SQL syntax looks like this:

CREATE TABLE `node_expire` (
`nid` int(10) unsigned NOT NULL default '0',
`expire` datetime default NULL,
`expiresec` varchar(10) NOT NULL default '',
`expiremode` enum('date','onupdate','none') NOT NULL default 'none',
`isroot` tinyint(1) NOT NULL default '0',
`lastnotify` int(10) NOT NULL default '0',
PRIMARY KEY (`nid`)
) TYPE=MyISAM;

I'm a complete SQL newbie (which I'm sure you had already guessed) so have no clue as to why there is an SQL Syntax error. MySQL version is 4.0.17 btw.

Thank you for your time

astoltz’s picture

Status: Active » Fixed

I changed that line to:

$query = db_query('SELECT nid FROM {node_expire} WHERE expire <= "%s" AND expiremode != "none"', date("Y-m-d H:i:s", time()-variable_get('node-expire-unpublishtime', 0)));

DATEDIFF was introduced in MySQL 4.1.1. I lightly tested this fix and it seems to be a working solution. Even though you don't have to, I highly recommend you upgrade to at least 4.1.22. The 4.0 release isn't even supported anymore.

pnc999’s picture

Thanks andyl56,

That line of code appears to have done the trick. I'll definitely look into upgrading mySQL version.

Thanks again for all your help.

Anonymous’s picture

Status: Fixed » Closed (fixed)