Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
926 views
in Q2A Core by
How do you turn off the ability to vote without viewing the question?

2 Answers

+2 votes
by
edited by
There isn't currently an admin option for this. So probably the easiest and most future-proof way is with an advanced HTML theme: http://www.question2answer.org/advanced.php#theme-advanced

You could override the vote_buttons(...) function so that it only outputs the buttons if you're viewing a question page. Code would be something like:

<?php

    class qa_html_theme extends qa_html_theme_base
    {
        function vote_buttons($post)
        {
            if ($this->template=='question')
                qa_html_theme_base::vote_buttons($post);
        }
    }
    
?>

... but I haven't tested it. It will remove voting buttons (but not vote count display) from any page which isn't a question page.
by
Thank you gidgreen, that worked out perfectly! Do you have a paypal donation link setup because I would like to send you some donations for the outstanding work and support you are doing on q2a
by
Kind of you to offer, but there's really no need - it's my pleasure.
by
If you want the voting options to still show after someone has voted, the condition needs to be:

if ($this->template=='question' || $this->template=='voting')
+3 votes
by
I think gidgreen's solution is gonna be the best way, but as promised here's what I did:

1. Change the signature of the voting function to this:
        function voting($post,$arrows=true)

2. Change the call to voting_inner_html in the voting function:
        $this->voting_inner_html($post,$arrows);

3. Change voting_inner_html to this:
        function voting_inner_html($post,$arrows=true)
        {
                if ($arrows)
                        $this->vote_buttons($post);
                $this->vote_count($post);
                $this->vote_clear();
        }

4. In the q_item_stats function, change the call to the voting function:
        $this->voting($question,false);
...