--- advuser_filters_original.inc	2008-05-16 05:16:18.000000000 +1200
+++ advuser_filters.inc	2008-05-25 21:34:53.000000000 +1200
@@ -5,7 +5,7 @@
  * filtering and apply actions to block, unblock, delete or email the selected
  * users.
  *
- * $Id: advuser_filters.inc,v 1.1.2.8 2008/05/15 17:16:18 earnie Exp $
+ * $Id: advuser_filters.inc,v 1.1.2.7 2008/03/26 20:03:43 earnie Exp $
  **/
 
 /**
@@ -21,6 +21,7 @@ function advuser_filter_form() {
     '#type' => 'fieldset',
     '#title' => t('Show only users where'),
     '#theme' => 'advuser_filters',
+    '#collapsible' => TRUE,
     );
   foreach ($session as $filter) {
     list($type, $value, $op, $qop) = $filter;
@@ -66,7 +67,6 @@ function advuser_filter_form() {
       );
     }
   }
-
   foreach ($filters as $key => $filter) {
     $names[$key] = $filter['title'];
     switch ($filter['form_type']) {
@@ -102,28 +102,11 @@ function advuser_filter_form() {
         if ($filter['autocomplete']) {
           $autocomplete = "profile/autocomplete/". $filter['autocomplete'];
         }
-        switch ($filter['type']) {
-          case 'selection': {
-            $form['filters']['status'][$key] = array(
-              '#type' => 'select',
-              '#options' => $filter['options'],
-              '#autocomplete_path' => $autocomplete,
-            );
-          } break;
-          case 'checkbox': {
-            $form['filters']['status'][$key] = array(
-              '#type' => 'checkbox',
-            );
-          } break;
-          default: {
-            $form['filters']['status'][$key] = array(
-              '#type' => $filter['type'],
-              '#options' => $filter['options'],
-              '#autocomplete_path' => $autocomplete,
-              '#size' => 20,
-            );
-          } break;
-        } //End switch ($filter['type']).
+        $form['filters']['status'][$key] = array(
+          '#type' => $filter['type'],
+          '#options' => $filter['options'],
+          '#autocomplete_path' => $autocomplete,
+        );
       } break;
     }
   }
@@ -155,28 +138,16 @@ function advuser_filter_form() {
   $form['filters']['filters_qops'] = array(
     '#type' => 'select',
     '#options' => array(
-      '=' => 'EQ', 
-      '!=' => 'NE', 
-      '<' => 'LT', 
-      '>' => 'GT',
-      '<=' => 'LE',
-      '>=' => 'GE',
-      'LIKE' => 'CO',
-      'NOT LIKE' => 'NC', 
-      'BEGINS WITH' => 'BE',
-      'ENDS WITH' => 'EN',
-    ),
-    '#attributes' => array('title' => t("
-      'EQ' => 'is equal to'
-      'NE' => 'is not equal to'
-      'LT' => 'is less than'
-      'GT' => 'is greater than'
-      'LE' => 'is less than or equal to'
-      'GE' => 'is greater than or equal to'
-      'CO' => 'contains'
-      'NC' => 'does not contain'
-      'BE' => 'begins with'
-      'EN' => 'ends with'")
+      '=' => 'equals', 
+      '!=' => 'is not equal to', 
+      '<' => 'is less than', 
+      '>' => 'is greater than',
+      '<=' => 'is less than or equal to',
+      '>=' => 'is greater than or equal to',
+      'LIKE' => 'contains',
+      'NOT LIKE' => 'does not contain', 
+      'BEGINS WITH' => 'begins with',
+      'ENDS WITH' => 'ends with',
     ),
   );
 
@@ -334,22 +305,15 @@ function advuser_filters() {
 
   $profile_fields = advuser_profile_fields();
   foreach ($profile_fields as $field) {
-    // Build array of options if they exist
-    $opts = NULL;
-    if ( ! empty($field->options) ) {
-      $opts = array();
-      foreach ( explode("\n", $field->options) as $opt ) {
-        $opt = trim($opt);
-        $opts[$opt] = $opt;
-      }
-    }
     $filters[$field->name] = array(
-      'title' => check_plain($field->title),
+      'title' => $field->title,
       'type' => $field->type,
       'join' => "LEFT JOIN {profile_fields} pf ON pf.fid = ".$field->fid." LEFT JOIN {profile_values} pv ON pv.fid = pf.fid",
       'where' => "pv.value %op '%s' AND pv.uid = u.uid",
-      'options' => $opts,
     );
+    if($field->autocomplete){
+       $filters[$field->name]['autocomplete'] = $field->fid; 
+    }
   }
   return $filters;
 }
