Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
The module adds attributes named "expire" and "expire_flag" to applicable nodes. So for a given node, you can check for the existence of one of these and print the date if desired. It's a datetime field, so if you have any particular date format requirements, you may need to do some extra work to get the format you need.
I think you should be able to use $node->expire and $node->expire_flag. And in your logic, switch the two ($node->expire_flag in the if condition and $node->expire printed out) or just use $node->expire in both cases.
This may warrant another thread, but is there a way to not delete nodes that have expired, but just print "Expired" in the view? I'd like to keep them in the database as archives if possible.
It doesn't delete nodes; it just sets their status to 0, unpublishing them. You should be able to get to the nodes via the admin interface and republish or use as a reference later.
Sorry, can't edit posts: maybe it would be easier if the posts expire just having them unpromoted from the frontpage (if they're on it), and having a field in the node printed "Expired".
That's really not what this module is designed to do. It'd be a pretty simple matter to update it (in the cron job, make it set "promoted" to 0 rather than "status" to 0), and perhaps it's something I'll add an option for at some time, but I don't see that happening in the near future. If you do this, you can also check $node->expire in your template to print whatever notice you desire if the node is in fact expired as of the display date.
Comments
Comment #1
dllh commentedThe module adds attributes named "expire" and "expire_flag" to applicable nodes. So for a given node, you can check for the existence of one of these and print the date if desired. It's a datetime field, so if you have any particular date format requirements, you may need to do some extra work to get the format you need.
Comment #2
blogfuse commentedSorry, I'm a PHP noob. This is what I've put in my node.tpl.php but without any luck:
I have no idea what I'm doing :)
Comment #3
dllh commentedI think you should be able to use $node->expire and $node->expire_flag. And in your logic, switch the two ($node->expire_flag in the if condition and $node->expire printed out) or just use $node->expire in both cases.
Comment #4
blogfuse commentedThis may warrant another thread, but is there a way to not delete nodes that have expired, but just print "Expired" in the view? I'd like to keep them in the database as archives if possible.
Comment #5
dllh commentedIt doesn't delete nodes; it just sets their status to 0, unpublishing them. You should be able to get to the nodes via the admin interface and republish or use as a reference later.
Comment #6
blogfuse commentedSorry, not trying to beat a dead horse here, but what about keeping their status published, but with a printed field that said "Expired on: X"
Comment #7
blogfuse commentedSorry, can't edit posts: maybe it would be easier if the posts expire just having them unpromoted from the frontpage (if they're on it), and having a field in the node printed "Expired".
Comment #8
dllh commentedThat's really not what this module is designed to do. It'd be a pretty simple matter to update it (in the cron job, make it set "promoted" to 0 rather than "status" to 0), and perhaps it's something I'll add an option for at some time, but I don't see that happening in the near future. If you do this, you can also check $node->expire in your template to print whatever notice you desire if the node is in fact expired as of the display date.
Comment #9
astoltz commentedThis has been added to the latest version.