-
FAQ
- Forum Search
- Community
- Online Manual
- Support Helpers of the Month
- Function Database
createPost
Description
Inserts a new post into the database with the appropriate options.
Syntax
bool createPost (array &$msgOptions, array &$topicOptions, array &$posterOptions)
Parameter &$msgOptions
Expected type: Array
Description: An array of information related specifically to the post - the body of the message, options such as whether or not smileys are enabled and the message icon
Array Elements of $msgOptions Key Optional Expected type Description body no Escaped String The message itself id no Integer The message ID (set after the message has been inserted and used when inserting the topic details) subject no Escaped String The subject of the post attachments yes Array of Integers An array containing attachment (or thumbnail) IDs for each attachment this post has (defaults to an empty array) icon yes String The message icon (defaults to 'xx') smileys_enabled yes Boolean Whether or not smileys are enabled (defaults to false)
Parameter &$topicOptions
Expected type: Array
Description: An array of information related to the entire topic - subject, id, poll info, locked/sticky info, etc.
Array Elements of $topicOptions Key Optional Expected type Description board no Integer The board ID id no Integer The topic ID (defaults to 0; actual value is set after topic info has been inserted) mark_as_read no Boolean Whether or not to mark the topic as read when it gets posted. Always true. lock_mode yes Integer 0 if the topic is being unlocked or 1 if the topic is being locked (defaults to null) poll yes Integer The ID of the poll associated with this topic (defaults to null) sticky_mode yes Integer 0 if the topic is being un-stickied, 1 if it's being stickied (defaults to null)
Parameter &$posterOptions
Expected type: Array
Description: An array of information related to the poster - IP, username, email address, etc.
Array Elements of $posterOptions Key Optional Expected type Description email no String The poster's email address ip no String The IP address of the poster (defaults to $user_info['ip']) name no Escaped String The name of the poster - either the user's display name or whatever name the guest entered update_post_count no Boolean Whether or not the user's post count should be updated (varies depending on the situation - false if they're a guest, there's no message ID or posts aren't enabled on that board; true otherwise) id yes Integer The ID of the member who posted this (defaults to 0)
Return value
Expected type: Boolean
Description: True if the post was successfully created, false otherwise
Notes
- Called from the Post2() function in Sources/Post.php after the input has been validated
- Sets up default values for the items which are marked optional
- Updates all the appropriate statistics
- Updates the custom search index, if there is one
Advertisement:- Help | Terms and Rules | Go Up ▲
- Copyright © 2022 Simple Machines. All Rights Reserved.
- Page created in 0.172 seconds with 12 queries.
- Forum Search