--- notify.module	Wed Aug 04 14:10:14 2010
+++ notify.module.new	Thu Aug 05 12:12:08 2010
@@ -434,6 +434,14 @@ function notify_admin_users() {
     '#description' => t('Send out any pending notification e-mails currently in queue.'),
   );
 
+  // Add notications to existing users 
+  $form['notify_add_existing_users'] = array(
+    '#title' => 'Add notications to existing users, using default settings',
+    '#type' => 'checkbox',
+    '#default_value' => FALSE,
+    '#description' => t('Add notifications to existing users who do not already have settings.'),
+  );
+
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save settings'));
 
   return $form;
@@ -466,6 +474,18 @@ function notify_admin_users_submit($form
     else {
       drupal_set_message(t('No notification e-mails needed to be sent.'));
     }
+  }
+
+  // Add notifications to existing users who do not have settings
+
+  if ($form_state['values']['notify_add_existing_users']) {
+    $result = db_query('SELECT uid FROM {users} WHERE uid not in (SELECT uid FROM {notify} WHERE 1)');
+    $entries = 0;
+    while ($one = db_fetch_object($result)) {
+      db_query('INSERT INTO {notify} (uid, status, node, teasers, comment, send_last) VALUES (%d, %d, %d, %d, %d, %d)', $one->uid, variable_get('notify_status_default'), variable_get('notify_node_default'), variable_get('notify_teasers_default'), variable_get('notify_comment_default'), 0);
+      $entries ++;
+    }
+    drupal_set_message(t('Default notification settings added to ' . $entries . ' existing users'));
   }
 }
 
