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

marcvangend - July 4, 2009 - 22:09
Status:active» needs review

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.

AttachmentSize
auto_expire_load_date.patch 505 bytes
auto_expire.module.txt 19.04 KB

#2

jfmoore - July 8, 2009 - 13:32

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

marcvangend - July 8, 2009 - 22:07
Assigned to:Anonymous» marcvangend

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.

AttachmentSize
auto_expire.zip 8.34 KB
auto_expire_load_show_date.patch 4.82 KB

#4

jfmoore - July 10, 2009 - 00:56

Thanks again.

#5

marcvangend - July 14, 2009 - 08:49

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

jfmoore - July 17, 2009 - 18:22

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

marcvangend - July 20, 2009 - 21:16
Status:needs review» fixed

Committed to HEAD.

#8

System Message - August 3, 2009 - 21:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.