--- advuser.module.orig	2007-06-02 23:45:47.000000000 +0100
+++ advuser.module	2007-09-19 12:02:11.000000000 +0100
@@ -12,6 +12,7 @@ define('ADVUSER_DEFAULT_NEW_NOTIFY', 1);
 define('ADVUSER_DEFAULT_MODIFY_NOTIFY', 1);
 define('ADVUSER_DEFAULT_LISTNO', 200);
 define('ADVUSER_DEFAULT_PROFILE_FIELDS', NULL);
+define('ADVUSER_DEFAULT_FILTERS', NULL);
 
 //define('ADVUSER_MAIL_MESSAGE_TEMPLATE', "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
 
@@ -72,27 +73,40 @@ function advuser_admin_filters() {
   $filters = array();
   
   // Regular filters
-  $filters['email'] = array(
-      'title' => t('E-mail'),
-      'where' => "u.mail = '%s'",
-    );
-  
-   $filters['uid'] = array(
-      'title' => t('User Id'),
-      'where' => "u.uid = '%s'",
-    );
 
+  // Get filters setting
+  $filters_check = variable_get('advuser_filters_check', '');
+
+  if ($filters_check['email']){
+    $filters['email'] = array(
+        'title' => t('E-mail'),
+        'where' => "u.mail = '%s'",
+      );
+  }
+
+  if ($filters_check['uid']){
+    $filters['uid'] = array(
+        'title' => t('User Id'),
+        'where' => "u.uid = '%s'",
+      );
+  }
+
+  if ($filters_check['uid']){
     $filters['access'] = array(
       'title' => t('Last Access'),
       'where' => "u.access = '%s'",
     );
+  }
+
+  if ($filters_check['uid']){
     $filters['status'] = array(
       'title' => t('Status'),
       'type'  => t('selection'),
       'options' => array(0 => t('Blocked'), 1 => ('Active')),
       'where' => 'u.status = %s',
     );
-		
+  }
+
   $fields = variable_get('advuser_profile_fields', ADVUSER_DEFAULT_PROFILE_FIELDS);
   if ( is_array($fields) ) {
     foreach ( $fields as $fid => $value) {
@@ -116,7 +130,7 @@ function advuser_admin_filters() {
       }
     }
   }
-  
+
   advuser_module_invoke('filter', $filters);
   return $filters;
 }
@@ -500,8 +514,8 @@ function advuser_admin_users_form() {
   while ($usr = db_fetch_object($result)) {
     $users[$usr->uid] = '';
     $form['name'][$usr->uid] = array('#value' => theme('username', $usr));
-
-    $form['status'][$account->uid] =  array('#value' => $status[$account->status]);
+    
+    $form['status'][$usr->uid] =  array('#value' => $status[$usr->status]);
     $form['access'][$usr->uid] = array('#value' => $usr->access ? t('%time ago', array('%time' => format_interval(time() - $usr->access))) : t('never'));
     //$form['access'][$usr->access] = array('#value' => ($usr->access ? format_interval(time() - $usr->access)));
     $form['operations'][$usr->uid] = array('#value' => l(t('edit'), 'user/'. $usr->uid .'/edit', array(), $destination));
@@ -704,7 +718,7 @@ function advuser_settings() {
       '#description' => t('The mail that is going to be sent to the selected roles when a user modifies their account.  You may insert substitution variables within this item.'),
       '#default_value' => variable_get('advuser_modify_mail', ADVUSER_DEFAULT_MODIFY_MAIL),
     );
-				
+
     //Maximum rows in dataset to display
     $form['advuser_mail']['advuser_listno'] = array(
       '#type' => 'select',
@@ -742,7 +756,29 @@ function advuser_settings() {
       = array('#type' => 'markup', 
               '#value' => '<div class="advuser-settings-warning"><strong>WARNING: No roles selected!</strong> - no email notifications will be sent.</div>');
   }
-    
+
+  // Filters settings
+
+  $form['advuser_filters'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Filter settings'),
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+    );
+
+  $values = variable_get('advuser_filters_check', '');
+  $options = array(
+    'email' => 'email', 'uid' => 'uid', 'access' => 'last access', 'status' => 'status'
+  );
+
+  $form['advuser_filters']['advuser_filters_check'] = array(
+        '#type' => 'checkboxes',
+        '#description' => t('Filters to be used.'),
+        '#title' => t('Filters'),
+        '#options' => $options,
+        '#default_value' => $values,
+      );
+
   if ( module_exists('profile') ) {
     $form['advuser_profile'] = array(
         '#type' => 'fieldset',
