--- delete_all.module	2007-12-22 22:22:05.000000000 -0500
+++ delete_all.module.new	2009-01-16 16:22:48.000000000 -0500
@@ -20,10 +20,171 @@ function delete_all_menu($maycache) {
     'callback arguments' => array('delete_all_users'),
     'access'             => user_access('administer users'),
     'type'               => MENU_NORMAL_ITEM);
-
+    
+  // Bulk Delete Form
+  $items[] = array(
+    'path'                =>  'admin/settings/bulk_delete',
+    'title'               => t('Bulk delete'),
+    'description'         => t('Bulk deletes nodes, taxonomy terms and users based on the their types.'),
+    'callback'            => 'drupal_get_form',
+    'callback arguments'  => array('delete_all_bulk_delete_content'),
+    'access'              => user_access('administer content'),
+    'type'                => MENU_NORMAL_ITEM
+  );
+  
+  // Bulk Delete Complete
+  $items[] = array(
+    'title'             =>  t('Items Deleted'),
+    'path'              =>  'admin/settings/bulk_delete/complete',
+    'callback'          =>  'delete_all_bulk_delete_content_complete',
+    'type'              =>  MENU_CALLBACK,
+    'access'            =>  user_access('administer content')
+  );  
   return $items;
 }
 
+/**
+* Form function for bulk delete content page
+**/
+function delete_all_bulk_delete_content($form_values = array()) {
+  $form_id = 'delete_all_bulk_delete_content';
+  $form = array();
+  //Fieldset for deleting taxonomy forms
+  $form['taxonomy'] = array(
+    '#type'             => 'fieldset',
+    '#access'           => user_access('administer content'),
+    '#title'            => t('Delete Taxonomy Terms'),
+    '#collapsible'      =>  FALSE
+  );
+  $form['taxonomy']['vocabulary'] = array(
+    '#title'          => t('Taxonomy Vocabulary'),
+    '#type'           => 'checkboxes',
+    '#description'    => t('Select which taxonomy vocabulary terms you wish to delete. This will not delete the vocabulary, only the terms within the vocabulary.'),
+    '#options'        => _delete_all_get_vocabulary()
+  );
+  //Fieldset for deleting nodes
+  $form['nodes'] = array(
+    '#type'           =>  'fieldset',
+    '#access'         =>  user_access('administer content'),
+    '#title'          =>  t('Delete Nodes'),
+    '#collapsible'    =>  FALSE
+  );
+  $form['nodes']['node_types'] = array(
+    '#type'           =>  'checkboxes',
+    '#title'          =>  t('Node types to delete'),
+    '#description'    =>  t('Select which node types you wish to delete'),
+    '#options'        =>  _delete_all_get_node_types()
+  );
+  return confirm_form(
+    $form,
+    t('Are you sure you wish to delete the content?'),
+    'admin/settings/bulk_delete',
+    'Are you sure you wish to delete the items?',
+    t('Delete'),
+    t('Cancel'),
+    'delete_all_bulk_delete_content_confirm'
+  );
+}
+
+/**
+* Implementation of hook_submit for bulk_delete_content form
+**/
+function delete_all_bulk_delete_content_submit($form_id,$form_values) {
+  //TODO: Display message with deletion statistics
+  //Iterate and delete any taxonomy terms if present
+  if(isset($form_values['vocabulary'])) {
+    $vocabulary = $form_values['vocabulary'];
+    foreach($vocabulary as $v) {
+      if($v > 0) {
+        //Get Vocabulary Info for message. 
+        $vocabulary_info = taxonomy_get_vocabulary($v);
+        //Get Array of terms to delete
+        $terms = _delete_all_get_terms_by_vid($v);
+        //Iterate through terms and delete them
+        foreach($terms as $term) {
+          taxonomy_del_term($term);
+        }
+        drupal_set_message("You have deleted " . count($terms) . ' terms of type ' . $vocabulary_info->name . '.');
+      }
+    }
+  }
+  //Iterate and delete nodes by type
+  if(isset($form_values['node_types'])) {
+    $node_types = $form_values['node_types'];
+    //$nodes = array();
+    foreach($node_types as $t) {
+      if(gettype($t) == 'string') {       
+        $nodes = _delete_all_get_nodes_by_type($t);
+        foreach($nodes as $n) {
+          node_delete($n);
+        }        
+      }
+    }
+  }
+  return "admin/settings/bulk_delete/complete";
+}
+
+/**
+* Function to display deletion complete message
+**/
+function delete_all_bulk_delete_content_complete() {
+ return t("Request has successfully been completed!"); 
+}
+
+/**
+* Function to get an array of terms by vocabulary
+* 
+* TODO: Is this an API function I couldn't find?
+**/
+function _delete_all_get_terms_by_vid($vid) {
+  $terms = array();
+  $result = db_query('SELECT t.tid from {term_data} t WHERE t.vid = %d',$vid);
+  while($term = db_fetch_object($result)) {
+    $terms[] = $term->tid;
+  }
+  return $terms;
+}
+
+/**
+* Function to get an array of nodes by type
+* 
+* TODO: Is this an API function I couldn't find?
+**/
+function _delete_all_get_nodes_by_type($type) {
+  $nodes = array();
+  $result = db_query("SELECT n.nid from {node} n WHERE n.type = '%s'",$type);
+  while($node = db_fetch_object($result)) {
+    $nodes[] = $node->nid;
+  }
+  return $nodes;
+}
+
+/**
+* Function to get array of taxonomy terms
+**/
+function _delete_all_get_vocabulary() {
+  $terms = taxonomy_get_vocabularies();
+  $options = array();
+  foreach($terms as $term) {
+    $options[$term->vid] = $term->name;   
+  }
+  return $options;
+}
+
+/**
+* Function to get an array of node types
+**/
+function _delete_all_get_node_types() {
+  $node_types = node_get_types();
+  $options = array();
+  foreach($node_types as $nt) {
+      $options[$nt->type] = $nt->name;
+  }
+  return $options;
+}
+
+
+/** Original delete_all functions **/
 function delete_all_content() {
   $form['action'] = array(
     '#type'  => 'hidden',
