Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
384 views
in Q2A Core by
I couldn't find answer to my question, but is it possible to allow only one answer per user?

I don't wish that Q2A would become some kind of forum, so if user is willing to answer the question he/she will have only 1 option. But they could still using replies.

I would also like to dissallow author of the question to post comment.

Am I asking too much? :)

Ty

1 Answer

+1 vote
by
(I'm assuming you're using the 1.2 beta here)

To disallow a user from posting more than one answer, modify function qa_page_q_load_q() in qa-page-question.php as follows:

if ($answers[$key]['isbyuser'])
    $useranswered=true;

... to ...

if ($answers[$key]['isbyuser']) {
    $useranswered=true;
    $question['answerbutton']=false;
}

To disallow the author of a question to post a comment, add this at the end of qa_page_q_post_rules(&$post) in the same file:

if ($post['isbyuser'] && ($post['basetype']=='Q'))
    $post['commentbutton']=false;
by
edited by
First mod is working, thx ;)

But second one isn't :(

At the end of function:
function qa_page_q_post_rules(&$post)

before:
}

I added:
        if ($post['isbyuser'] && ($post['basetype']=='Q'))
            $post['commentbutton']=false;

Did I do anything wrong?

PS: yes, its beta 1.2

Update!
Ups yes its working :) I did mistake and ask you how to remove comment button, but I was thinking Answer button :( sorry my bad

Update 2!
        if ($post['isbyuser'] && ($post['basetype']=='Q'))
           $post['answerbutton']=false;

Simple :)
...