? search_config_default_search.patch
Index: search_config.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/search_config/search_config.module,v
retrieving revision 1.8.2.5
diff -u -p -r1.8.2.5 search_config.module
--- search_config.module	21 Oct 2007 02:37:25 -0000	1.8.2.5
+++ search_config.module	14 Sep 2008 18:47:37 -0000
@@ -43,6 +43,18 @@ function search_config_perm() {
  * Implementation of hook_form_alter()
  */
 function search_config_form_alter($form_id, &$form) {
+  //present the user with the appropriate search results tab
+  //as defined in the advanced search settings in search settings
+  if ($form['#base'] == 'search_box_form') {
+    $mod = variable_get('search_config_default_search', 'node');
+    $form['#submit'] = array();
+    $form['#submit']['search_form_submit'] = array();
+    $form['module']['#value'] = $mod;
+    $form['module']['#type'] = 'hidden';
+    $form['processed_keys'] = $form['search_theme_form_keys'];    
+    $form['processed_keys']['#weight'] = -1;    
+    unset($form['search_theme_form_keys']);
+  }
   if ($form_id == 'search_form') {
     if (arg(1) == 'node') {
       
@@ -163,6 +175,22 @@ function search_config_search($op) {
         '#collapsed' => TRUE,
       );
 
+      //Default search results tab to display when searching from the search box:
+      //Presents radios - one for each implementor of hook_search
+      $implementors = module_implements('search',false, false);
+      unset ($implementors[array_search('search_config', $implementors)]);
+      foreach($implementors as $imp) {
+        $imparr[$imp] = $imp;
+      }
+      $form['search_config']['search_config_default_search'] = array(
+        '#type' => 'radios',
+        '#title' => t('Default Search'),
+        '#options' => $imparr,
+        '#multiple' => FALSE,
+        '#default_value' => variable_get('search_config_default_search', 'node'),
+        '#description' => t('Which search to execute by default')
+        );
+       
       // Keyword boxes:
       $form['search_config']['keywords'] = array(
         '#type' => 'fieldset',
