Index: user_prune.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/user_prune/user_prune.admin.inc,v
retrieving revision 1.3
diff -u -r1.3 user_prune.admin.inc
--- user_prune.admin.inc	3 Jul 2009 18:39:11 -0000	1.3
+++ user_prune.admin.inc	19 Feb 2010 15:31:36 -0000
@@ -43,7 +43,7 @@
 		'#options' => array(31556926 => t('Years'), 2629744 => t('Months'), 604800 => t('Weeks'), 86400 => t('Days'), 3600 => t('Hours')),
 		'#default_value' => variable_get('prune_never_registered_limit_unit', 2629744)
 	);
-	
+
 	$form['has_logged_in'] = array(
 		'#type' => 'fieldset',
 		'#title' => t('Users who have logged in before')
@@ -88,7 +88,15 @@
 		'#options' => array(500 => 500, 200 => 200, 100 => 100, 75 => 75, 50 => 50, 25 => 25, 10 => 10),
 		'#default_value' => variable_get('prune_per_run', 100)
 	);
-	
+	$form['prune_status'] = array(
+		'#type' => 'select',
+		'#options' => array(2 => t('Both'), 1 => t('Active'), 0 => t('Blocked')),
+		'#title' => t('Limit by the status of the users'),
+		'#description' => t('If this option is set to Active, then Blocked users are never deleted, and vica versa. In case of Both, the pruning is not limited by the status of the users.'),
+		'#default_value' => variable_get('prune_status', 2)
+	);
+
+
 	$form['prune_now'] = array(
 		'#type' => 'fieldset',
 		'#title' => t('Prune Now'),
@@ -162,7 +170,8 @@
 			variable_set('prune_logged_in_registered_limit_unit', $values['prune_logged_in_registered_limit_unit']);
 		}
 		variable_set('prune_per_run', $values['prune_per_run']);
-		
+		variable_set('prune_status', $values['prune_status']);
+
 		drupal_set_message(t('The configuration options have been saved.'));
 	}
 	elseif ($values['op'] == t('Prune Now')) {
@@ -183,16 +192,19 @@
 			$limit = time() - $rollback;
 			$sql .= ' AND created < ' . $limit;
 		}
-		
+		if ($values['prune_status'] <> 2) {
+			$sql .= ' AND status = ' . $values['prune_status'];
+		}
+
 		// can't delete the anonymous user or the super-user
 		$sql .= ' AND uid <> 0 AND uid <> 1';
-		
+
 		$result = db_query($sql);
 		while ($data = db_fetch_object($result)) {
 			$uids[] = $data->uid;
 		}
 	}
-	
+
 	if ($values['prune_logged_in'] && ($values['prune_logged_in_logged_in_limit_length'] != '' || $values['prune_logged_in_registered_limit_length'] != '')) {
 		$sql = 'SELECT uid FROM {users} WHERE login <> 0';
 		if ($values['prune_logged_in_logged_in_limit_length']) {
@@ -205,10 +217,13 @@
 			$limit = time() - $registered_rollback;
 			$sql .= ' AND created < ' . $limit;
 		}
-		
+		if ($values['prune_status'] <> 2) {
+			$sql .= ' AND status = ' . $values['prune_status'];
+		}
+
 		// can't delete the anonymous user or the super-user
 		$sql .= ' AND uid <> 0 AND uid <> 1';
-		
+
 		$result = db_query($sql);
 		while ($data = db_fetch_object($result)) {
 			$uids[] = $data->uid;

