Пример #1
0
 //echo $query;
 $database->setQuery($query);
 $user_ids = (array) $database->loadResultArray();
 //Get all active users in this season
 // BUG 397 - placeholders unavailable for email template. Fix supplied by James Butler
 $query = "SELECT ju.*, u.email, u.name, u.username FROM #__jtips_users ju JOIN #__users u ON ju.user_id = u.id WHERE ju.status = 1 AND season_id = {$season_id} AND ju.id NOT IN ('" . implode("', '", $user_ids) . "') AND u.block = 0";
 //echo $query;
 $database->setQuery($query);
 $rows = (array) $database->loadAssocList();
 jTipsLogger::_log('found ' . count($rows) . ' users to try to send to ', 'info');
 foreach ($rows as $user) {
     ksort($user);
     $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);