Index: default_filter.module
===================================================================
RCS file: /www/REPOSITORIES/contrib/contributions/modules/default_filter/default_filter.module,v
retrieving revision 1.9
diff -u -r1.9 default_filter.module
--- default_filter.module	3 Sep 2007 01:21:34 -0000	1.9
+++ default_filter.module	15 Jul 2008 19:21:31 -0000
@@ -52,7 +52,8 @@
   foreach(node_get_types() as $type){
     $types[$type->type] = $type->name;
   }
-
+  $types['default_filter_block'] = 'Block Filter';
+  
   $form['new'] = array(
     '#type' => 'fieldset',
     '#title' => t('New Filter Association'),
@@ -187,8 +188,8 @@
   * is equal to #return_value, so we set #value to the format value
   * to make the two line up.
   */
-function default_filter_form_alter($form_id, &$form){
-  if($form['#id'] == 'node-form' && array_key_exists('body_filter', $form)){
+function default_filter_form_alter($form_id, &$form) {
+  if($form['#id'] == 'node-form' && array_key_exists('body_filter', $form)) {
     $form['default_filter_passed_form'] = array(
       '#type' => 'value',
       '#value' => 1,
@@ -226,6 +227,44 @@
       }
     }
   }
+  else if ('block_box_form' == $form_id && array_key_exists('body_filter', $form)) {
+     $form['default_filter_passed_form'] = array(
+      '#type' => 'value',
+      '#value' => 1,
+    );
+    
+    $format = default_filter_retrieve('default_filter_block');
+
+    //The following two if statements are the result of an anomaly I never figured
+    //out but needed to code around. My install used "filter" as the key for the
+    //formats, but others' installs used "format". This block looks for each. I've
+    //also added below an if statement to confirm that whichever one gets set exists.
+    $format_key = 'this is not a valid key';
+    if(array_key_exists('filter', $form['body_filter'])){
+      $format_key = 'filter';
+    }
+    if(array_key_exists('format', $form['body_filter'])){
+      $format_key = 'format';
+    }
+
+    if(array_key_exists($format_key, $form['body_filter']) && $format && !isset($form['nid']['#value'])){
+      //Unset any pre-selected filter. If multiples are checked, Gecko
+      //browsers seem to take the last selected but IE takes the first selected.
+      foreach($form['body_filter'][$format_key] as $key => $val){
+        if (is_numeric($key)) {
+          if (isset($form['body_filter'][$format_key][$key]['#value'])) {
+            unset($form['body_filter'][$format_key][$key]['#value']);
+          }
+          if (isset($form['body_filter'][$format_key][$key]['#default_value'])) {
+            unset($form['body_filter'][$format_key][$key]['#default_value']);
+          }
+        }
+      }
+      if(isset($form['body_filter'][$format_key][$format])){
+        $form['body_filter'][$format_key][$format]['#default_value'] = $format;
+      }
+    }
+  }
 }
 
 /**
