--- scheduler.module.original	2009-10-16 18:10:11.000000000 +0100
+++ scheduler.module	2009-12-18 13:37:58.520435241 +0000
@@ -73,11 +73,17 @@ function scheduler_form_alter(&$form, $f
   //allow scheduling on a per-node-type basis
 
   if ('node_type_form' == $form_id) {
-    $form['workflow']['scheduler'] = array(
+    $form['workflow']['scheduler_pub'] = array(
       '#type' => 'checkbox',
-      '#title' => t('Enable scheduled (un)publishing'),
-      '#default_value' => variable_get('scheduler_'. $form['#node_type']->type, 0),
-      '#description' => t('Check this box to enable scheduled (un)publishing for this node type.')
+      '#title' => t('Enable scheduled publishing'),
+      '#default_value' => variable_get('scheduler_pub_'. $form['#node_type']->type, 0),
+      '#description' => t('Check this box to enable scheduled publishing for this node type.')
+    );
+    $form['workflow']['scheduler_unpub'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Enable scheduled unpublishing'),
+      '#default_value' => variable_get('scheduler_unpub_'. $form['#node_type']->type, 0),
+      '#description' => t('Check this box to enable scheduled unpublishing for this node type.')
     );
     $form['workflow']['scheduler_touch'] = array(
       '#type' => 'checkbox',
@@ -90,8 +96,11 @@ function scheduler_form_alter(&$form, $f
   // is this a node form?
   elseif (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id) {
     if (user_access('schedule (un)publishing of nodes')) {
+    
+      $pub_enabled = variable_get('scheduler_pub_'. $form['type']['#value'], 0) == 1;
+      $unpub_enabled = variable_get('scheduler_unpub_'. $form['type']['#value'], 0) == 1;
       // if scheduling has been enabled for this node type
-      if (variable_get('scheduler_'. $form['type']['#value'], 0) == 1) {
+      if ($pub_enabled || $unpub_enabled) {
 
         $node = $form['#node'];
 
@@ -130,34 +139,42 @@ function scheduler_form_alter(&$form, $f
           '#weight' => 35
         );
 
-        $form['scheduler_settings']['publish_on'] = array(
-          '#type' => 'textfield',
-          '#title' => t('Publish on'),
-          '#maxlength' => 25,
-          '#default_value' => isset($defaults->publish_on) && $defaults->publish_on ? format_date($defaults->publish_on, 'custom', $internal_date_format) : '',
-          '#description' => t('Format: %time. Leave blank to disable scheduled publishing.', array('%time' => format_date(time(), 'custom', $date_format))),
-        );
-
-        $form['scheduler_settings']['unpublish_on'] = array(
-          '#type' => 'textfield',
-          '#title' => t('Unpublish on'),
-          '#maxlength' => 25,
-          '#default_value' => isset($defaults->unpublish_on) && $defaults->unpublish_on ? format_date($defaults->unpublish_on, 'custom', $internal_date_format) : '',
-          '#description' => t('Format: %time. Leave blank to disable scheduled unpublishing.', array('%time' => format_date(time(), 'custom', $date_format))),
-        );
+        if ($pub_enabled) {
+          $form['scheduler_settings']['publish_on'] = array(
+            '#type' => 'textfield',
+            '#title' => t('Publish on'),
+            '#maxlength' => 25,
+            '#default_value' => isset($defaults->publish_on) && $defaults->publish_on ? format_date($defaults->publish_on, 'custom', $internal_date_format) : '',
+            '#description' => t('Format: %time. Leave blank to disable scheduled publishing.', array('%time' => format_date(time(), 'custom', $date_format))),
+          );
+        }
+
+        if ($unpub_enabled) {
+          $form['scheduler_settings']['unpublish_on'] = array(
+            '#type' => 'textfield',
+            '#title' => t('Unpublish on'),
+            '#maxlength' => 25,
+            '#default_value' => isset($defaults->unpublish_on) && $defaults->unpublish_on ? format_date($defaults->unpublish_on, 'custom', $internal_date_format) : '',
+            '#description' => t('Format: %time. Leave blank to disable scheduled unpublishing.', array('%time' => format_date(time(), 'custom', $date_format))),
+          );
+        }
 
         if (module_exists('date_popup')) {
           // Make this a popup calendar widget if Date Popup module is enabled.
-          $form['scheduler_settings']['publish_on']['#type'] = 'date_popup';
-          $form['scheduler_settings']['publish_on']['#date_format'] = $date_format;
-          $form['scheduler_settings']['publish_on']['#date_year_range'] = '0:+10';
-          $form['scheduler_settings']['publish_on']['#description'] = t('Leave blank to disable scheduled publishing.');
-          unset($form['scheduler_settings']['publish_on']['#maxlength']);
-          $form['scheduler_settings']['unpublish_on']['#type'] = 'date_popup';
-          $form['scheduler_settings']['unpublish_on']['#date_format'] = $date_format;
-          $form['scheduler_settings']['unpublish_on']['#date_year_range'] = '0:+10';
-          $form['scheduler_settings']['unpublish_on']['#description'] = t('Leave blank to disable scheduled unpublishing.');
-          unset($form['scheduler_settings']['unpublish_on']['#maxlength']);
+          if ($pub_enabled) {
+            $form['scheduler_settings']['publish_on']['#type'] = 'date_popup';
+            $form['scheduler_settings']['publish_on']['#date_format'] = $date_format;
+            $form['scheduler_settings']['publish_on']['#date_year_range'] = '0:+10';
+            $form['scheduler_settings']['publish_on']['#description'] = t('Leave blank to disable scheduled publishing.');
+            unset($form['scheduler_settings']['publish_on']['#maxlength']);
+          }
+          if ($unpub_enabled) {
+            $form['scheduler_settings']['unpublish_on']['#type'] = 'date_popup';
+            $form['scheduler_settings']['unpublish_on']['#date_format'] = $date_format;
+            $form['scheduler_settings']['unpublish_on']['#date_year_range'] = '0:+10';
+            $form['scheduler_settings']['unpublish_on']['#description'] = t('Leave blank to disable scheduled unpublishing.');
+            unset($form['scheduler_settings']['unpublish_on']['#maxlength']);
+          }
         }
       }
     }
@@ -320,7 +337,7 @@ function _scheduler_get_user_timezone() 
 function scheduler_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
   // Run $op == load for any user.
   if ($op == 'load') {
-    if (isset($node->nid) && $node->nid && variable_get('scheduler_'. $node->type, 0) == 1) {
+    if (isset($node->nid) && $node->nid && ((variable_get('scheduler_pub_'. $node->type, 0) == 1) || (variable_get('scheduler_unpub_'. $form['type']['#value'], 0) == 1))) {
       $result = db_query('SELECT * FROM {scheduler} WHERE nid = %d', $node->nid);
       if ($result) {
         $row = db_fetch_array($result);
