Development Wiki

Function.submit post

From phpBB Development Wiki

Revision as of 21:30, 8 April 2009 by A jelly doughnut (Talk | contribs)

submit_post –– Posts a topic or post to the forum with the information supplied


  1. mixed submit_post ( $mode,  $subject,  $username,  $topic_type,  &$poll,  &$data, [ $update_message = true])

To post a new message to the forums use the submit_post function. It handles all necessary changes. On success it returns the URL of the post, otherwise it returns false.


Parameter Usage
mode Determines what type of posting should be done. Can be post, edit, reply, or delete.
subject The subject of the message.
username Username of the poster. Only valid for guest posters.
topic_type One of the phpBB3 topic type constants. POST_NORMAL, POST_STICKY, POST_ANNOUNCE, POST_GLOBAL
poll Poll data
data The post data in an array.
update_message (optional, default is true)

Data Array

The $data array deserves further explanation. Key items to note:

  • The array is passed by reference. The post ID of the submitted post will be available in $data after submit_post has been run.
  • If you wish to submit a reply to a topic, pass that topic id in $data['topic_id']. If you want to create a new topic, give zero here.
  • There is no way to change the poster or post time using this array.