--- delete_all.module	2009-02-13 15:09:04.000000000 -0700
+++ delete_allNew.module	2009-02-13 15:08:54.000000000 -0700
@@ -50,6 +50,19 @@ function delete_all_menu($maycache) {
 function delete_all_bulk_delete_content($form_values = array()) {
   $form_id = 'delete_all_bulk_delete_content';
   $form = array();
+  //Fieldset for deleting content by taxonomy term
+  $form['taxonomynodes'] = array(
+    '#type'             => 'fieldset',
+    '#access'           => user_access('administer content'),
+    '#title'            => t('Delete Content by Taxonomy Term'),
+    '#collapsible'      =>  FALSE
+  );
+  $form['taxonomynodes']['node_terms'] = array(
+    '#title'          => t('Taxonomy Node Vocabulary'),
+    '#type'           => 'checkboxes',
+    '#description'    => t('Select taxonomy terms whose content you wish to delete. This will not delete the vocabulary or the term. Any content associated with selected terms will be deleted.  Consider increasing your PHP max_execution_time value if you are deleting lots of nodes, as it may take a while.'),
+    '#options'        => _delete_all_get_terms()
+  );
   //Fieldset for deleting taxonomy forms
   $form['taxonomy'] = array(
     '#type'             => 'fieldset',
@@ -122,6 +135,21 @@ function delete_all_bulk_delete_content_
       }
     }
   }
+  //Iterate and delete nodes by taxonomy term
+  if(isset($form_values['node_terms'])) {
+    $node_terms = $form_values['node_terms'];
+    foreach($node_terms as $t) {
+	  if($t > 0) {
+	    $nodes = _delete_all_get_nodes_by_tid($t);
+		if($nodes) {
+		  foreach($nodes as $n) {
+		    node_delete($n);
+		  }        
+        }
+      }  
+    }
+  }
+  
   return "admin/settings/bulk_delete/complete";
 }
 
@@ -133,6 +161,19 @@ function delete_all_bulk_delete_content_
 }
 
 /**
+* Function to get an array of nids by taxonomy term
+* 
+**/
+function _delete_all_get_nodes_by_tid($tid) {
+  $terms = array();
+  $result = db_query(db_rewrite_sql("SELECT t.tid, t.nid AS n FROM {term_node} t WHERE t.tid = %d"), $tid);
+  while($term_nodes = db_fetch_object($result)) {
+    $nodes[] = $term_nodes->n;
+  }
+  return $nodes;
+}
+
+/**
 * Function to get an array of terms by vocabulary
 * 
 * TODO: Is this an API function I couldn't find?
@@ -161,7 +202,7 @@ function _delete_all_get_nodes_by_type($
 }
 
 /**
-* Function to get array of taxonomy terms
+* Function to get array of vocabularies
 **/
 function _delete_all_get_vocabulary() {
   $terms = taxonomy_get_vocabularies();
@@ -184,6 +225,28 @@ function _delete_all_get_node_types() {
   return $options;
 }
 
+/**
+* Function to get array of all taxonomy terms that have nodes
+**/
+function _delete_all_get_terms() {
+  $vocabularies = taxonomy_get_vocabularies();
+  $options = array();
+  foreach($vocabularies as $vocabulary) {
+    $terms = _delete_all_get_terms_by_vid($vocabulary->vid);
+    foreach($terms as $tid) {
+      $term = taxonomy_get_term($tid);
+	  $result = db_query('SELECT count(*) AS c from {term_node} t WHERE t.tid = %d', $tid);
+	  while($termcount = db_fetch_object($result)){
+        $count = $termcount->c;
+      }
+	  if($count) {
+	     $options[$tid] = $vocabulary->name . ' - ' .$term->name . ' (' . $count . ' nodes)';
+		 }
+	}
+  }
+  return $options;
+}
+
 
 /** Original delete_all functions **/
 function delete_all_content() {
