--- invite.module.orig	2009-12-07 21:42:42.000000000 +0100
+++ invite.module	2009-12-07 16:50:45.000000000 +0100
@@ -40,7 +40,11 @@ function invite_help($path, $arg) {
       $output = '<p>'. t("The invitations shown on this page haven't been accepted yet.");
       break;
     case 'user/%/invites/expired':
-      $output = '<p>'. t('The invitations shown on this page have not been used to register on the site within the expiration period of @count days.', array('@count' => variable_get('invite_expiry', 30)));
+      if('never' == variable_get('invite_expiry', 30)) {
+        $output = '<p>'. t('The invitations shown on this page have not been used to register on the site.');
+      } else {
+        $output = '<p>'. t('The invitations shown on this page have not been used to register on the site within the expiration period of @count days.', array('@count' => variable_get('invite_expiry', 30)));
+      }
       break;
 
     default:
@@ -441,7 +445,7 @@ function invite_validate($invite) {
     drupal_set_message(t('This invitation has already been used. Please login now with your username and password.'));
     drupal_goto('user');
   }
-  else if ($invite->expiry < time()) {
+  else if (!empty($invite->expiry) && $invite->expiry < time()) {
     drupal_set_message(t('Sorry, this invitation has expired.'));
     drupal_goto();
   }
@@ -1213,7 +1217,13 @@ function invite_save($edit) {
   $edit = (array)$edit;
   $data = serialize($edit['data']);
   $now = time();
-  $expiry = $now + (variable_get('invite_expiry', 30) * 60 * 60 * 24);
+  $expiry = 0; // 0 means: does not expire
+
+  // If expiry is set to time value set the time of expiration
+  if ('never' != variable_get('invite_expiry', 30)) {
+    $expiry = $now + (variable_get('invite_expiry', 30) * 60 * 60 * 24);    
+  } 
+
   if ($edit['resent']) {
     $result = db_query("UPDATE {invite} SET expiry = %d, resent = %d, data = '%s' WHERE reg_code = '%s' AND uid = %d", $expiry, $edit['resent'], $data, $edit['code'], $edit['inviter']->uid);
   }
@@ -1248,7 +1258,7 @@ function invite_cancel(&$form_state, $or
         '#type' => 'value',
         '#value' => $invite,
       );
-      $description = (!$invite->joined && $invite->expiry > time()) ? t("The invitee won't be able to register any more using this invitation.") : '';
+      $description = (!$invite->joined && !empty($invite->expiry) && $invite->expiry > time()) ? t("The invitee won't be able to register any more using this invitation.") : '';
 
       return confirm_form(
         $form,
@@ -1295,7 +1305,7 @@ function invite_resend($invite) {
   global $user;
 
   // Inviter must match current user and invitation must have expired.
-  if ($invite->uid == $user->uid && $invite->expiry < time()) {
+  if ($invite->uid == $user->uid && !empty($invite->expiry) && $invite->expiry < time()) {
     return drupal_get_form('invite_form', 'page', $invite);
   }
 
@@ -1317,9 +1327,9 @@ function invite_count($uid, $op) {
     case 'accepted':
       return db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d AND joined <> 0", $uid));
     case 'pending':
-      return db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d AND joined = 0 AND expiry >= %d", $uid, time()));
+      return db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d AND joined = 0 AND (expiry = 0 OR expiry >= %d)", $uid, time()));
     case 'expired':
-      return db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d AND joined = 0 AND expiry < %d", $uid, time()));
+      return db_result(db_query("SELECT COUNT(*) FROM {invite} WHERE uid = %d AND joined = 0 AND expiry != 0 AND expiry < %d", $uid, time()));
   }
 }
 
--- invite_admin.inc.orig	2009-12-07 21:42:54.000000000 +0100
+++ invite_admin.inc	2009-12-07 16:49:41.000000000 +0100
@@ -35,7 +35,7 @@ function invite_settings() {
     '#type' => 'select',
     '#title' => t('Invitation expiry'),
     '#default_value' => variable_get('invite_expiry', 30),
-    '#options' => drupal_map_assoc(array(1, 3, 7, 14, 30, 60)),
+    '#options' => drupal_map_assoc(array(1, 3, 7, 14, 30, 60, 'never'), 't'),
     '#description' => t('Set the expiry period for user invitations, in days.'),
     '#multiple' => FALSE,
     '#required' => TRUE,
