Index: postcard.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/postcard/postcard.module,v
retrieving revision 1.18.2.2
diff -u -p -r1.18.2.2 postcard.module
--- postcard.module	6 Feb 2007 20:29:31 -0000	1.18.2.2
+++ postcard.module	30 Apr 2007 01:01:48 -0000
@@ -99,6 +99,13 @@ function postcard_settings() {
     '#type' => 'fieldset',
     '#title' => t('Miscellaneous settings'),
   );
+  $form['misc']['postcard_cron'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Days to keep postcards'),
+    '#description' => t('Postcards that are aged more than the number of days entered above will automatically be deleted from the database. Use 0 to never delete. Note that this will only be checked when cron.php is run.'),
+    '#size' => '2',
+    '#default_value' => variable_get('postcard_cron', '0'),
+  );
   $form['misc']['postcard_help'] = array(
     '#type' => 'textarea',
     '#title' => t('Explanation or submission guidelines'),
@@ -388,6 +395,17 @@ function postcard_page_submit($form_id, 
   drupal_goto('postcard');
 }
 
+/**
+ * Implementation of hook_cron().
+ **/
+function postcard_cron() {
+  // convert cron days into timestamp
+  $postcard_cron = variable_get('postcard_cron', '0') * 86400;
+  // delete postcards older than setting
+  if (!empty($postcard_cron)) {
+  db_query('DELETE FROM {postcard} WHERE send_time < %d', time() - $postcard_cron);
+  }
+}
 
 /**
  * Theme a gallery page (taken from theme_image_gallery)
