Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
612 views
in Q2A Core by
edited by

I wanna post questions ( random questions) programatically. just like how anonymous users do and the admin had to approve it. So it is important that the posted question does not appear to users untill admin approves it

How can i do that? What script files i have to touch ?

thanks a lot

update:

i found my answer here :http://question2answer.org/external.php

this way i can post questions anonymously using external php script however i also need to add the name of the person and his email too. How /where can i add those two fields fields?


 
 

1 Answer

+2 votes
by
Thanks to this well documented script. I found the answer from http://question2answer.org/external.php

 

<?php
require_once 'qa-include/qa-base.php';

require_once QA_INCLUDE_DIR . 'qa-app-users.php';
require_once QA_INCLUDE_DIR . 'qa-app-posts.php';

$type = 'Q_QUEUED'; // question
$parentid = null; // does not follow another answer
$title = 'Why do birds sing?';
$content = '<html>2222222 <b>And</b> why do ....<br/>next line</html>?';
$format = 'html'; // plain text
$categoryid = null; // assume no category
$tags = array (
        'birds',
        'sing',
        'love'
);
$userid = null; // qa_get_logged_in_userid()+1;
$notify = null;
$email = "anything@anything.www";
$name = 'John';
// function qa_post_create($type, $parentid, $title, $content, $format='', $categoryid=null, $tags=null, $userid=null, $notify=null, $email=null, $extravalue=null, $name=null)
$questionId = qa_post_create ( $type, $parentid, $title, $content, $format, $categoryid, $tags, $userid, null, null, null, $name );
...