Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
336 views
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
by
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:

acount=0
... to ...
acount>0

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
by
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'){
      $oldnavigation=$navigation;
      $navigation="";
      //reorder -> list the Q&A Tab:
      $navigation['$']=$oldnavigation['$'];
      //reorder -> list the question Tab:
      $navigation['questions']=$oldnavigation['questions'];
      //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]))
          {
            $navigation[$key]=$oldnavigation[$key];
          }
      }
    }
    qa_html_theme_base::nav_list($navigation, $navtype);
  }
}

 


ready :))

...