Is there a way to print the expires on date? I think that would be pretty helpful.

Comments

dllh’s picture

Assigned: Unassigned » dllh
Status: Active » Closed (fixed)

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.

blogfuse’s picture

Sorry, I'm a PHP noob. This is what I've put in my node.tpl.php but without any luck:

<?php if ($expire): ?><?php print $expire_flag ?><?php endif; ?>

I have no idea what I'm doing :)

dllh’s picture

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.

blogfuse’s picture

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.

dllh’s picture

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.

blogfuse’s picture

Sorry, 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"

blogfuse’s picture

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".

dllh’s picture

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.

astoltz’s picture

This has been added to the latest version.