Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Q2A Core by
This would be a very good feature. Ability to import many questions at once via CSV or other type of file format. Huge time saver for admins creating a new site with desired questions. This should be a core feature. Yes? Thanks for your input.
Q2A version: latest
There's a paid plugin for this (see plugins page) and it is not very difficult to create one for self. We use one for our purpose following latex input as that's how our questions are. The core input part is hardly 30 lines of code. But adding to core will be troublesome as different users will have different requirements.

1 Answer

+1 vote

It is not really hard to do.

Basic steps:

  1. Parse your questions from CSV file, for example.
  2. Include these files in your script:
    • /qa-include/qa-base.php
    • qa-app-users.php
    • qa-app-posts.php
  3. Now you can use core function qa_post_create() to post questions.
Code example:
//Parse questions from your source and put data in array

//Include Q2A scripts:

require_once '/PATH/TO/qa-include/qa-base.php';
require_once QA_INCLUDE_DIR.'qa-app-users.php';
require_once QA_INCLUDE_DIR.'qa-app-posts.php';

//Publish questions:

qa_post_create($type, $parentid, $title, $content, $format, $categoryid, $tags, $userid);


You can find more info here - https://docs.question2answer.org/code/external/