1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-08 15:46:44 +02:00

Plugin FAQs: Added "Ask a Question" limit preference

This commit is contained in:
Cameron
2015-04-02 12:34:32 -07:00
parent 1740161a49
commit 077489bb72
5 changed files with 19 additions and 6 deletions

View File

@@ -204,9 +204,11 @@ class faq
{
$sql = e107::getDb();
if($sql->select('faqs','faq_id',"faq_answer='' AND faq_author_ip = '".USERIP."' LIMIT 1"))
$existing = $sql->select('faqs','faq_id',"faq_answer='' AND faq_author_ip = '".USERIP."' ");
if(!empty($this->pref['submit_question_limit']) && $existing >= $this->pref['submit_question_limit'])
{
e107::getMessage()->setTitle('Sorry',E_MESSAGE_INFO)->addInfo("You may only ask another question once your other question has been answered.");
e107::getMessage()->setTitle('Sorry',E_MESSAGE_INFO)->addInfo("You have reached the maximum number of new questions. You may ask more once your existing questions have been answered.");
return;
}