Example #1
0
 public static function flagAR($subscriberID, $subscribeARA)
 {
     $db = JFactory::getDBO();
     foreach ($subscribeARA as $subscribeAR) {
         //get the id of the ar with the max delay in subscribeARA
         $maxDelayAR = jNews_Mailing::maxDelayAR($subscribeAR);
         if (empty($maxDelayAR)) {
             return true;
         }
         //we insert an entry in the queue that will flag that the last mail in the ar has been already sent to the user
         //here insert in the delay column  the listid of the AR so that we will no longer get the listid of the mailing through another query
         $time = time();
         $senddate = $time + $maxDelayAR->delay * 60;
         $query = 'INSERT IGNORE INTO `#__jnews_queue`(subscriber_id, type, mailing_id, delay, send_date,suspend)';
         $query .= 'VALUES(' . $subscriberID . ',8,' . $maxDelayAR->id . ',' . $subscribeAR . ',' . $senddate . ',1)';
         $db->setQuery($query);
         $db->query();
     }
     return false;
 }