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

I'm using this example http://www.question2answer.org/external.php everything seems good, but when i using $extravalue, additional field doesn't show up in question. What i did wrong ? 

$type='Q'; // question
    $parentid=null; // does not follow another answer
    $title='Why do birds sing?';
    $content='And why do they fall in love?';
    $extravalue='test field info';
    $format=''; // plain text
    $categoryid=null; // assume no category
    $tags=array('birds', 'sing', 'love');
    $userid=qa_get_logged_in_userid();
    
    qa_post_create($type, $parentid, $title, $content, $format, $categoryid, $tags, $userid, $extravalue);

Is it bug in q2a ?

by
Anyone succeed using in $extravalue ? Extra field is just ignored while creating post in external...

2 Answers

+2 votes
by
selected by
 
Best answer

You are putting the value into the wrong field. The signature for qa_post_create is:

function qa_post_create($type, $parentid, $title, $content, $format='', $categoryid=null, $tags=null, $userid=null, $notify=null, $email=null, $extravalue=null, $name=null)

So you are putting the extravalue into the $notify value. You'll need to add some extra nulls, i.e.

qa_post_create($type, $parentid, $title, $content, $format, $categoryid, $tags, $userid, null, null, $extravalue)
0 votes
by

Please check the qa_post_meta table , 

there the extra field value will be set with a id as post id and key 'qa_q_extra'

by
edited by
Extra field value was not set after testing again. (i'm cheked database). It shows up only when posting question as normal...
...