Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
in Q2A Core by

Is it possible to create additional page where be best rated questions.

1 Answer

+3 votes
You could do this via a page plug-in in the upcoming beta release. The only issue is that the corresponding database query (SELECT ... FROM ^posts WHERE TYPE='Q' ORDER BY CONVERT(upvotes, SIGNED) - CONVERT(downvotes, SIGNED)) would not have an appropriate index, so it would get slow for a large database.
asked Nov 4, 2010 in Plugins by
edited Nov 13, 2011 by
Could someone provide a "Best Questions"-Plugin example?
Like the guide in this post (http://www.question2answer.org/qa/626/most-popular-questions-tab#a630) I tried to create a best question feature.
The folllowing sqlstatement works (SQL Client only) and all question are sorted by up and downvotes.

But in my q2a webpage the results are not (!) sorted by up and downvotes.

Any Ideas?

       function qa_db_best_qs_selectspec($voteuserid, $start, $categoryslug=null, $createip=null, $hidden=false, $fullanswers=false, $count=QA_DB_RETRIEVE_QS_AS)
                $selectspec=qa_db_posts_basic_selectspec($voteuserid, null);

                $selectspec['source'].=" JOIN (SELECT postid FROM ^posts WHERE ".(isset($categoryslug) ? "categoryid=(SELECT categoryid FROM ^categories WHERE tags=$ LIMIT 1) AND " : "")."type=$ ORDER BY CONVERT(^posts.upvotes, SIGNED) - CONVERT(^posts.downvotes, SIGNED) DESC  LIMIT #,#) y ON ^posts.postid=y.postid";

                if (isset($categoryslug))

                array_push($selectspec['arguments'], $hidden ? 'Q_HIDDEN' : 'Q', $start, $count);


                return $selectspec;



                 case 'bestquestions':

                        if (!qa_home_load_ifcategory(
                                'page_size_qs', 'feed_for_questions', 'cache_qcount', 'main/most_answered_qs_title', 'main/no_questions_found', 'main/most_answered_qs_title', 'main/no_questions_found',
                                qa_db_best_qs_selectspec($qa_login_userid, $qa_start, $categoryslug)
                                return $qa_content;

                        if (isset($categoryid)) {

                        } else