1

This question is related to this post

Create topic in phpBB3 by php file

Now i am able to create topics in phpBB form by script. Now my problem is, I want to post/replies in newly created topics.

For this i modified submit function like this:-

         $data = array(
            'forum_id' => 8,
            'icon_id' => false,
            'enable_bbcode' => true,
            'enable_smilies' => true,
            'enable_urls' => true,
            'enable_sig' => true,
            'post_visibility' => 1,

            'topic_id' =>$topicId,  //this is newly created topic id. 
            'poster_id' => 2,
            'post_text' => "Myreply",
            'notify_set' => false,
            'notify' => false,
            'post_visibility' => 1,
            'post_edit_locked' => 0,
            'post_time' => 0,
            'enable_indexing' => true,
            'force_approved_state' => true,
        );
        submit_post('post', $my_subject, '', POST_NORMAL, $poll, $data);

But replies are not created. If i use old question variables then topics is created not replies.

So how i can create replies by this function?

UPDATE

I notice that i am getting this while i am passing data in 'post_text'

  Column 'post_text' cannot be null [1048]<br /><br />An SQL error occurred while fetching this page.
Community
  • 1
  • 1
neo
  • 107
  • 1
  • 14
  • If i directly insert data in phpbb_post table then every-time i need to synchronize forum, from admin area so this is not a good idea to insert replies. – neo Jul 28 '15 at 20:38

2 Answers2

0

Look at the docs of submit_post(), the body of the message (the post text), should be in the message field of the array you're passing to the function not in a post_text field.

vvondra
  • 3,022
  • 1
  • 21
  • 34
  • Thanks but now i am getting 'Column 'forum_id' cannot be null [1048]', While i am giving forum_id. – neo Aug 03 '15 at 19:37
0

The mode (first parameter of submit_post()) should be reply for replies, and post for new topics.

imkingdavid
  • 1,411
  • 13
  • 26