$jTipsUser = new jTipsUser($database); $jTipsUser->load($user['id']); //jTipsLogger::_log($jTipsUser); if ($jTipsUser->getPreference('email_reminder')) { $recipient = $user['email']; $user['round'] = $round[0]['round']; $user['competition'] = $round[0]['season']; $user['season'] = $round[0]['season']; $body = parseTemplate($body, $variables, $user); $record = array('round_id' => $round[0]['id'], 'user_id' => $user['id'], 'notified' => 0); $attempted++; if (jTipsMail($from, $fromname, $recipient, $subject, $body)) { $record['notified'] = 1; jTipsLogger::_log('sent reminder email to ' . $recipient . ' subject: ' . $subject . ' from: ' . $fromname . ' <' . $from . '>', 'info'); $sent++; } else { jTipsLogger::_log('failed to send reminder email to ' . $recipient, 'error'); } $jRemind = new jRemind($database); $jRemindParams = array('round_id' => $record['round_id'], 'user_id' => $record['user_id']); $jRemind->loadByParams($jRemindParams); $jRemind->attempts++; $jRemind->bind($record); $jRemind->save(); } } } $result = 'Sent ' . $sent . ' out of ' . $attempted . ' jTips reminder emails for ' . count($season_ids) . ' seasons'; jTipsLogger::_log($result, 'INFO'); echo $result; exit;