Index: pathauto.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.module,v
retrieving revision 1.44.2.4
diff -u -p -r1.44.2.4 pathauto.module
--- pathauto.module	17 Jan 2007 17:02:42 -0000	1.44.2.4
+++ pathauto.module	19 Jan 2007 19:53:37 -0000
@@ -102,6 +102,16 @@ function pathauto_admin_settings() {
     '#default_value' => FALSE,
     '#description' => t('Generate index aliases based on all pre-existing aliases.'));
 
+  $form['general']['pathauto_alias_unpublished'] = array(
+    '#type' => 'radios',
+    '#title' => t('Unpublished Nodes'), 
+    '#default_value' => variable_get('pathauto_alias_unpublished', 1),
+    '#options' => array(
+        t('Delete/Do not create aliases'),
+        t('Create Aliases'),
+      ),
+    '#description' => t('What should pathauto do when nodes are not yet published or are unpublished?'));
+
   $form["general"]["pathauto_update_action"] = array('#type' => 'radios',
     '#title' => t('Update action'), '#default_value' => variable_get('pathauto_update_action', 2),
     '#options' => array(t('Do nothing, leaving the old alias intact'),
@@ -627,4 +637,4 @@ function _pathauto_update() {
     drupal_set_message('Upgraded pathauto from '.$installed_version["build"] .
       ' to '. $current_version["build"]);
   }
-} // end function _pathauto_update
+} // end function _pathauto_update
\ No newline at end of file
Index: pathauto_node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto_node.inc,v
retrieving revision 1.29.2.2
diff -u -p -r1.29.2.2 pathauto_node.inc
--- pathauto_node.inc	17 Jan 2007 16:53:41 -0000	1.29.2.2
+++ pathauto_node.inc	19 Jan 2007 19:53:37 -0000
@@ -77,9 +77,23 @@ function pathauto_nodeapi(&$node, $op, $
     switch ($op) {
       case 'insert':
       case 'update':
-        $placeholders = node_get_placeholders($node);
-        $src = "node/$node->nid";
-        $alias = pathauto_create_alias('node', $op, $placeholders, $src, $node->type);
+        $alias_unpublished = variable_get('pathauto_alias_unpublished', 1);
+        // if the node has been published or
+        // we should create an alias for unpublished nodes
+        if(($node->status == 1) || ($alias_unpublished == 1)) {
+          $placeholders = node_get_placeholders($node);
+          $src = "node/$node->nid";
+          $alias = pathauto_create_alias('node', $op, $placeholders, $src, $node->type);
+        } 
+        else {
+          path_set_alias('node/'.$node->nid);
+        } 
+        break;
+      case 'delete':
+          $alias_unpublished = variable_get('pathauto_alias_unpublished', 1);
+          if($alias_unpublished == 0) {  
+            path_set_alias('node/'.$node->nid);
+          }
         break;
       default:
         break;
@@ -320,4 +334,4 @@ function node_pathauto_page() {
 
   drupal_set_title(t($pagetitle));
   return $output;
-}
+}
\ No newline at end of file
