Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
in Q2A Core by
First of all thank you gidgreen for the wonderful platform.

Today we have hosted http://www.sapchat.com using Q&A platform.

Is there a way to add a tab for Answered questions?

2 Answers

0 votes
There's not an easy way to do it, but if you're happy customizing the PHP:

1. Add a rule in $qa_routing at the top of qa-page.php which maps:

'answered' => QA_INCLUDE_DIR.'qa-page-home.php',

2. Copy the function qa_db_unanswered_qs_selectspec(...) in qa-db-selects.php to a new function qa_db_answered_qs_selectspec, and make the simple change of:

... to ...

3. Add a rule in the big switch {...} in qa-page-home.php which is an exact copy of the 'questions' rule, but substitute qa_db_unanswered_qs_selectspec for qa_db_answered_qs_selectspec.

4. In your new rule in qa-page-home.php, change the language phrases (which start main/...) for something else, and add those language phrases.

5. You'll also need to fix the $count variable in this section by subtracting the current value (which will be the unanswered questions count) from the total number of questions - see how that's retrieve in qa-page-admin-stats.php.

I haven't tried this though, so let us know how you get on!
+1 vote
edited by

or by using a custom theme:

  1. create one as described in q2a help
  2. open qa-theme.php
  3. add the following code:

class qa_html_theme extends qa_html_theme_base
  function nav_list($navigation, $navtype)
    if ($navtype=='main'){
      //reorder -> list the Q&A Tab:
      //reorder -> list the question Tab:
      //rename or add tab e.g. for answered questions:
      $navigation['custom_0']=array( 'url' => './answers','label' => 'Answers','title' => 'show all answered questions...');
      //reorder - if you want to: just add more here...

      // add on any remaining ones
      foreach ($oldnavigation as $key => $navlink){
        if (!isset($navigation[$key]))
    qa_html_theme_base::nav_list($navigation, $navtype);


ready :))

Welcome to the Q&A site for Question2Answer.

If you have a question about Q2A, please ask here, in English.

To report a bug, please create a new issue on Github or ask a question here with the bug tag.

If you just want to try Q2A, please use the demo site.

April 20, 2021: Q2A 1.8.6 released!