123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <?php
- if (!defined('STATUSNET')) {
- exit(1);
- }
- class UserInviteReminderHandler extends UserReminderHandler {
- const INVITE_REMINDER = 'invite';
-
- function transport() {
- return 'uinvrem';
- }
-
- function sendNextReminder($invitem)
- {
- list($invitation, $opts) = $invitem;
- $invDate = strtotime($invitation->created);
- $now = strtotime('now');
-
- $days = ($now - $invDate) / 86499;
-
- $siteName = common_config('site', 'name');
- if ($days > 7 && isset($opts['onetime'])) {
-
-
- if (Email_reminder::needsReminder(self::INVITE_REMINDER, $invitation)) {
- common_log(LOG_INFO, "Sending one-time invitation reminder to {$invitation->address}", __FILE__);
- $subject = _m("Reminder - you have been invited to join {$siteName}!");
- return EmailReminderPlugin::sendReminder(
- self::INVITE_REMINDER,
- $invitation,
- $subject,
- -1
- );
- }
- }
- switch($days) {
- case ($days > 1 && $days < 2):
- if (Email_reminder::needsReminder(self::INVITE_REMINDER, $invitation, 1)) {
- common_log(LOG_INFO, "Sending one day invitation reminder to {$invitation->address}", __FILE__);
-
- $subject = sprintf(_m('Reminder - You have been invited to join %s!'),$siteName);
- return EmailReminderPlugin::sendReminder(
- self::INVITE_REMINDER,
- $invitation,
- $subject,
- 1);
- } else {
- return true;
- }
- break;
- case ($days > 3 && $days < 4):
- if (Email_reminder::needsReminder(self::INVITE_REMINDER, $invitation, 3)) {
- common_log(LOG_INFO, "Sending three day invitation reminder to {$invitation->address}", __FILE__);
-
- $subject = sprintf(_m('Final reminder - you have been invited to join %s!'),$siteName);
- return EmailReminderPlugin::sendReminder(
- self::INVITE_REMINDER,
- $invitation,
- $subject,
- 3
- );
- } else {
- return true;
- }
- break;
- default:
- common_log(LOG_INFO, "No need to send invitation reminder to {$invitation->address}.", __FILE__);
- break;
- }
- return true;
- }
- }
|