Index: widgets.php
===================================================================
--- widgets.php	(revision 11091)
+++ widgets.php	(working copy)
@@ -164,8 +164,10 @@
 		$this->_set( $widget_args['number'] );
 		$settings = $this->get_settings();
 
-		if ( array_key_exists( $this->number, $settings ) )
-			$this->widget($args, $settings[$this->number]);
+		if ( array_key_exists( $this->number, $settings ) ) {
+            $hide_widget = apply_filters('widget_display_test', $this); //Add hook to test if widget should be displayed. Sends the widget object as a variable. If the call returns ***false*** the widget will not be displayed.   
+            if (!$hide_widget) $this->widget($args, $settings[$this->number]); //Test and display widget. 
+        }
 	}
 
 	/** Deal with changed settings.
@@ -222,8 +224,11 @@
 					else
 						$instance = $this->update($new_instance, array());
 
-					if ( false !== $instance )
-						$all_instances[$number] = $instance;
+					if ( false !== $instance ) {
+                        $widget_options_compare = array($new_instance,$instance); //This array is used to compare the intended instance values (sent iva _POST) with the values overridden by the $this->update function. 
+                        $instance = apply_filters('default_widget_options_update',$widget_options_compare, $this);  //Callback to apply default and/or other options/instance values to be added to list of widget options/values to store in database. Should return widget options/values as array to be updated.
+                        $all_instances[$number] = $instance;
+                    }
 				}
 			}
 
@@ -250,7 +255,9 @@
 			$instance = $all_instances[ $widget_args['number'] ];
 		}
 
-		return $this->form($instance);
+		$this->form($instance);
+        
+        do_action('default_widget_options_display', $this); //Add action hook to display default widget information or options. Sends the widget object as a variable. Anything output by the called function will be displayed below the widget options set by the form function.
 	}
 
 	/** Helper function: Registers a single instance. */
