"Unanswered Questions Report", //TODO LAN 'function' => "unanswered", 'category' => "notify", 'description' => "Mails a report of unanswered questions to ".e107::pref('core','siteadminemail').'.' // TODO LAN ); return $cron; } function unanswered() { $sql = e107::getDb(); $tp = e107::getParser(); $limit = 25; $count = $sql->retrieve('faqs','faq_id',"faq_answer='' ", true); $existing = $sql->retrieve('faqs','faq_id,faq_question,faq_datestamp',"faq_answer='' ORDER BY faq_datestamp DESC LIMIT ".$limit, true); if(empty($existing)) { return; } $questions = array(); foreach($existing as $row) { $questions[] = "".$row['faq_question']."
".$tp->toDate($row['faq_datestamp'],'short')."\n"; // $questions[] = $row['faq_question']; } // // $questions = array( "Test Question
".$tp->toDate(time(),'short').""); $name = SITENAME . " Automation"; $email = e107::pref('core','siteadminemail'); $name = e107::pref('core','siteadmin'); $link = $tp->replaceConstants("{e_PLUGIN}faqs/admin_config.php?mode=main&action=list&filter=pending", 'full'); $body = "

".count($count)." Unuanswered Questions at ".SITENAME."

To answer these questions, please login to ".SITENAME." and then click here.
The ".$limit." most recent questions are displayed below. "; $eml = array( 'subject' => count($count)." Unuanswered Question as of ".date('d-M-Y')." ", // 'sender_email' => $email, 'sender_name' => SITENAME . " Automation", // 'replyto' => $email, 'html' => true, 'template' => 'default', 'body' => $body ); e107::getEmail()->sendEmail($email, $name, $eml); } } ?>