Display expiration date in node
jfmoore - July 4, 2009 - 11:46
| Project: | Auto Expire |
| Version: | 6.x-1.0-rc1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | marcvangend |
| Status: | closed |
Description
It would be nice to have the option to display the expiration date in the node, perhaps like other fields.

#1
This should do the trick. I have attached both the patch file and, for quick and easy testing, the altered module file (remove the .txt extension if you want to use it).
The patch will add two values to the $node object, like this:
stdClass Object(
[... all other node elements ...]
[auto_expire] => Array
(
[timestamp] => 1246790890
[date] => Sun, 2009-07-05 12:48
)
)
So you could put this in your node.tpl.php:
<p>This node will expire on <?php print $auto_expire['date']; ?>.</p>Your feedback is appreciated.
#2
So you could put this in your node.tpl.php:<p>This node will expire on <?php print $auto_expire['date']; ?>.</p>
Thanks. I wonder, though, how this might be done in a CCK field so as to not have to mess with the node.tpl.php file?
#3
I think you should not add the exporation date like a CCK field, because the expiration date is not the actual content, it's meta data. The node links is a more appropriate place to display this kind of info.
Anyway, I did a second version - I hope you like it :-) Once again I'm attaching two files, the patch file and the comlete zipped module (not a .txt, because two files have changed).
To enable the display of the expiration date, go to /admin/settings/auto_expire. You can choose between three options for each content type: "Never", "Only if user has permission to extend" and "Always". In case the node is about to expire and the user has the right to extend the node and the setting is not 'never', you will also see a link to the node extension page.
Thanks for testing.
#4
Thanks again.
#5
jfmoore: I'd appreciate any feedback you can give; if I know that this works for you without problems, I can commit the changes.
#6
I haven't used it a great deal. Just posted a few test ads, but it seems to be working okay. Expiration emails are being sent in a timely fashion, and I just extended one of the test ads which seemed to go okay, too.
#7
Committed to HEAD.
#8
Automatically closed -- issue fixed for 2 weeks with no activity.