]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/EmailReminder/lib/userinvitereminderhandler.php
Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x
[quix0rs-gnu-social.git] / plugins / EmailReminder / lib / userinvitereminderhandler.php
index 5e5c6726414950bcad460c9c77c91cdfc6175eb3..70c666178c389a1e5911552a0d64eccfcc654577 100644 (file)
@@ -63,19 +63,37 @@ class UserInviteReminderHandler extends UserReminderHandler {
      *
      * @todo Abstract this stuff further
      *
-     * @param Invitation $invitation
+     * @param array $invitem Invitation obj and any special options
      * @return boolean success value
      */
-    function sendNextReminder($invitation)
+    function sendNextReminder($invitem)
     {
+        list($invitation, $opts) = $invitem;
+
         $invDate = strtotime($invitation->created);
         $now     = strtotime('now');
 
         // Days since first invitation was sent
         $days = ($now - $invDate) / 86499; // 60*60*24 = 86499
+        // $days = ($now - $regDate) / 120; // Two mins, good for testing
 
         $siteName = common_config('site', 'name');
 
+        if ($days > 7 && isset($opts['onetime'])) {
+            // Don't send the reminder if we're past the normal reminder window and
+            // we've already pestered her at all before
+            if (Email_reminder::needsReminder(self::INVITE_REMINDER, $invitation)) {
+                common_log(LOG_INFO, "Sending one-time invitation reminder to {$invitation->address}", __FILE__);
+                $subject = _m("One time reminder - you have been invited to join {$siteName}!");
+                return EmailReminderPlugin::sendReminder(
+                    self::INVITE_REMINDER,
+                    $invitation,
+                    $subject,
+                    -1 // special one-time indicator
+                );
+            }
+        }
+
         switch($days) {
         case ($days > 1 && $days < 2):
             if (Email_reminder::needsReminder(self::INVITE_REMINDER, $invitation, 1)) {