--- inactive_user.module.orig	2009-06-11 15:27:33.000000000 -0400
+++ inactive_user.module	2009-08-20 01:09:34.000000000 -0400
@@ -83,6 +83,13 @@ function inactive_user_custom_settings()
     '#options' => $period,
     '#description' => t('Generate an email to notify the site administrator that a user account hasn\'t been used for longer than the specified amount of time.  Requires crontab.'),
   );
+  $form['inactive_user_notification']['inactive_user_notify_admin_frequency'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Days between admin notifications'),
+    '#description' => t('The time (in days) between subsequent notifications.'),
+    '#default_value' => variable_get('inactive_user_notify_admin_frequency', 14),
+    '#size' => 10,
+  );
   $form['inactive_user_notification']['inactive_user_notify'] = array(
     '#type' => 'select',
     '#title' => t('Notify users when they haven\'t logged in for more than'),
@@ -90,6 +97,13 @@ function inactive_user_custom_settings()
     '#options' => $period,
     '#description' => t('Generate an email to notify users when they haven\'t used their account for longer than the specified amount of time.  Requires crontab.'),
   );
+  $form['inactive_user_notification']['inactive_user_notify_frequency'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Days between user notifications'),
+    '#description' => t('The time (in days) between subsequent notifications.'),
+    '#default_value' => variable_get('inactive_user_notify_frequency', 14),
+    '#size' => 10,
+  );
   $form['inactive_user_notification']['inactive_user_notify_text'] = array(
     '#type' => 'textarea',
     '#title' => t('Body of user notification e-mail'),
@@ -226,6 +240,13 @@ function inactive_user_custom_settings_v
   elseif ($count > 1) {
     form_set_error('inactive_user_admin_email', t('The following e-mail addresses are invalid: %mail', array('%mail' => implode(', ', $invalid))));
   }
+  
+  if (!is_numeric($form_state['values']['inactive_user_notify_admin_frequency'])) {
+    form_set_error('inactive_user_notify_admin_frequency', t('You must enter a number for "Days between admin notifications".'));
+  }
+  if (!is_numeric($form_state['values']['inactive_user_notify_frequency'])) {
+    form_set_error('inactive_user_notify_frequency', t('You must enter a number for "Days between user notifications".'));
+  }
 }
 
 /**
@@ -253,11 +274,11 @@ function inactive_user_cron() {
     if ($notify_time = variable_get('inactive_user_notify_admin', 0)) {
       $result = db_query('SELECT uid, name, mail, access, created FROM {users} WHERE ((access <> 0 AND login <> 0 AND access < (%d - %d)) OR (login = 0 AND created < (%d - %d))) AND uid <> 1', time(), $notify_time, time(), $notify_time);
       while ($user = db_fetch_object($result)) {
-        if ($user->uid && !db_fetch_object(db_query('SELECT uid FROM {inactive_users} WHERE uid = %d AND notified_admin = 1', $user->uid)) && ($user->created < (time() - $notify_time))) {
-          db_query('UPDATE {inactive_users} SET notified_admin = 1 WHERE uid = %d', $user->uid);
+        if ($user->uid && !db_fetch_object(db_query('SELECT uid FROM {inactive_users} WHERE uid = %d AND %d < (notified_admin + %d)', $user->uid, time(), (variable_get('inactive_user_notify_admin_frequency', 14) * 86400))) && ($user->created < (time() - $notify_time))) {
+          db_query('UPDATE {inactive_users} SET notified_admin = %d WHERE uid = %d', time(), $user->uid);
           if (!db_affected_rows()) {
             // must create a new row
-            @db_query('INSERT INTO {inactive_users} (uid, notified_admin) VALUES (%d, 1)', $user->uid);
+            @db_query('INSERT INTO {inactive_users} (uid, notified_admin) VALUES (%d, %d)', $user->uid, time());
           }
           $user_list .= "$user->name ($user->mail) last active on ". format_date($user->access, 'large') .".\n";
         }
@@ -271,11 +292,12 @@ function inactive_user_cron() {
     // notify users that their account has been inactive
     if ($notify_time = variable_get('inactive_user_notify', 0)) {
       $result = db_query('SELECT * FROM {users} WHERE ((access <> 0 AND login <> 0 AND access < (%d - %d)) OR (login = 0 AND created < (%d - %d))) AND status <> 0 AND uid <> 1', time(), $notify_time, time(), $notify_time);
+      $row = db_fetch_object(db_query('SELECT uid FROM {inactive_users} WHERE uid = %d AND %d > (notified_user + %d)', $user->uid, time(), (variable_get('inactive_user_notify_frequency', 14) * 86400)));
       while ($user = db_fetch_object($result)) {
-        if ($user->uid && !db_fetch_object(db_query('SELECT uid FROM {inactive_users} WHERE notified_user = 1 AND uid = %d', $user->uid)) && ($user->created < (time() - $notify_time))) {
-          db_query('UPDATE {inactive_users} SET notified_user = 1 WHERE uid = %d', $user->uid);
+        if ($user->uid && !db_fetch_object(db_query('SELECT uid FROM {inactive_users} WHERE uid = %d AND %d < (notified_user + %d)', $user->uid, time(), (variable_get('inactive_user_notify_frequency', 14) * 86400))) && ($user->created < (time() - $notify_time))){
+          db_query('UPDATE {inactive_users} SET notified_user = %d WHERE uid = %d', time(), $user->uid);
           if (!db_affected_rows()) {
-            @db_query('INSERT INTO {inactive_users} (uid, notified_user) VALUES (%d, 1)', $user->uid);
+            @db_query('INSERT INTO {inactive_users} (uid, notified_user) VALUES (%d, %d)', $user->uid, time());
           }
           _inactive_user_mail(t('[@sitename] Account inactivity', array('@sitename' => variable_get('site_name', 'drupal'))), variable_get('inactive_user_notify_text', _inactive_user_mail_text('notify_text')), $notify_time, $user, NULL);
           watchdog('user', 'user %user notified of inactivity', array('%user' => $user->name), WATCHDOG_INFO, l(t('edit user'), "admin/user/edit/$uid"));
