phpBB

Development Wiki

Difference between revisions of "Function.submit post"

From phpBB Development Wiki

(Parameters)
(Add a few details on $data)
Line 31: Line 31:
 
| (optional, default is true)
 
| (optional, default is true)
 
|}<br>
 
|}<br>
 +
 +
== 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.

Revision as of 21:30, 8 April 2009

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

Description

  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.

Parameters

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.