public static function processTypeEightfromQueue() { $ARtoUnsubA = array(); $followupToSubscribeA = array(); //get entries in the queue where type =8 $typeEightinQueue = jNews_Queue::typeEight(); if (empty($typeEightinQueue)) { return false; } foreach ($typeEightinQueue as $oneTypeEight) { $subscriberId = $oneTypeEight->subscriber_id; $ARtoUnsubA[0] = $oneTypeEight->delay; //we use the delay column of the queue saving the AR id being subscribed of the subscriber $mailId = $oneTypeEight->mailing_id; //we get the followup of the listid saved in the delay column $followupid = jNews_Lists::getFollowup($ARtoUnsubA[0]); $followupToSubscribeA[0] = $followupid; //$subs=jNews_ListsSubs::getSubs($subscriberId); //we unsubscribe the user from the list using the data saved in the delay column in the queue jNews_ListsSubs::_applyChangedSubscription($subscriberId, '', $ARtoUnsubA); //we delete this type 8 entry in the queue $db = JFactory::getDBO(); $query = 'DELETE FROM `#__jnews_queue` WHERE `type`=8 AND `subscriber_id`=' . $subscriberId . ' AND `mailing_id`=' . $mailId; $db->setQuery($query); $db->query(); //we subscribe the user to the followup if ($followupToSubscribeA[0] != 0 && !empty($followupToSubscribeA[0])) { jNews_ListsSubs::_applyChangedSubscription($subscriberId, $followupToSubscribeA, ''); $followupType = jNews_Lists::getListType($followupid); if ($followupType == 2) { //we add entries in the queue if the type is equal 2 jNews_ListsSubs::subscribeARtoQueue($subscriberId, $followupToSubscribeA); } } //$subs=jNews_ListsSubs::getSubs($subscriberId); } return true; }