Function __global->cns_make_post
Definitions
sources/cns_posts_action.php
- Add a post.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: int
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $topic_id | AUTO_LINK | No | No | required parameter | N/A | N/A | The ID of the topic to add the post to |
| $title | SHORT_TEXT | No | No | required parameter | N/A | N/A | The title of the post (may be blank) |
| $post | LONG_TEXT | No | No | required parameter | N/A | N/A | The post |
| $skip_sig | BINARY | No | No | 0 | N/A | N/A | Whether to skip showing the posters signature in the post |
| $is_starter | ?boolean | No | No | False | N/A | N/A | Whether the post is the first in the topic (null: work it out) |
| $validated | ?BINARY | No | No | Null | N/A | N/A | Whether the post is validated (null: unknown, find whether it needs to be not validated initially) |
| $is_emphasised | BINARY | No | No | 0 | N/A | N/A | Whether the post is marked emphasised |
| $poster_name_if_guest | ?string | No | No | Null | N/A | N/A | The name of the person making the post (null: username of current member) |
| $ip_address | ?IP | No | No | Null | N/A | N/A | The IP address the post is to be made under (null: IP of current user) |
| $time | ?TIME | No | No | Null | N/A | N/A | The time of the post (null: now) |
| $poster | ?MEMBER | No | No | Null | N/A | N/A | The poster (null: current member) |
| $whisper_to_member | ?MEMBER | No | No | Null | N/A | N/A | The member that this post is intended solely for (null: public) |
| $last_edit_time | ?TIME | No | No | Null | N/A | N/A | The last edit time of the post (null: never edited) |
| $last_edit_member | ?MEMBER | No | No | Null | N/A | N/A | The member that was last to edit the post (null: never edited) |
| $check_permissions | boolean | No | No | True | N/A | N/A | Whether to check permissions for whether the post may be made as it is given |
| $update_caching | boolean | No | No | True | N/A | N/A | Whether to update the caches after making the post |
| $forum_id | ?AUTO_LINK | No | No | Null | N/A | N/A | The forum the post will be in (null: find out from the DB) |
| $support_attachments | boolean | No | No | True | N/A | N/A | Whether to allow attachments in this post |
| $topic_title | ?string | No | No | Blank (empty string) | N/A | N/A | The title of the topic (null: find from the DB) |
| $id | ?AUTO_LINK | No | No | Null | N/A | N/A | Force an ID (null: don't force an ID) |
| $anonymous | boolean | No | No | False | N/A | N/A | Whether to make the post anonymous |
| $skip_post_checks | boolean | No | No | False | N/A | N/A | Whether to skip post checks |
| $is_pt | ?boolean | No | No | False | N/A | N/A | Whether this is for a new Private Topic (null: work it out, or assume false if $is_starter evaluates to false) |
| $insert_comcode_as_admin | boolean | No | No | False | N/A | N/A | Whether to explicitly insert the Comcode with admin privileges |
| $parent_id | ?AUTO_LINK | No | No | Null | N/A | N/A | Parent post ID (null: none-threaded/root-of-thread) |
Returns
- The ID of the new post
- Type: AUTO_LINK
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Add a post.
*
* @param AUTO_LINK $topic_id The ID of the topic to add the post to
* @param SHORT_TEXT $title The title of the post (may be blank)
* @param LONG_TEXT $post The post
* @param BINARY $skip_sig Whether to skip showing the posters signature in the post
* @param ?boolean $is_starter Whether the post is the first in the topic (null: work it out)
* @param ?BINARY $validated Whether the post is validated (null: unknown, find whether it needs to be not validated initially)
* @param BINARY $is_emphasised Whether the post is marked emphasised
* @param ?string $poster_name_if_guest The name of the person making the post (null: username of current member)
* @param ?IP $ip_address The IP address the post is to be made under (null: IP of current user)
* @param ?TIME $time The time of the post (null: now)
* @param ?MEMBER $poster The poster (null: current member)
* @param ?MEMBER $whisper_to_member The member that this post is intended solely for (null: public)
* @param ?TIME $last_edit_time The last edit time of the post (null: never edited)
* @param ?MEMBER $last_edit_member The member that was last to edit the post (null: never edited)
* @param boolean $check_permissions Whether to check permissions for whether the post may be made as it is given
* @param boolean $update_caching Whether to update the caches after making the post
* @param ?AUTO_LINK $forum_id The forum the post will be in (null: find out from the DB)
* @param boolean $support_attachments Whether to allow attachments in this post
* @param ?string $topic_title The title of the topic (null: find from the DB)
* @param ?AUTO_LINK $id Force an ID (null: don't force an ID)
* @param boolean $anonymous Whether to make the post anonymous
* @param boolean $skip_post_checks Whether to skip post checks
* @param ?boolean $is_pt Whether this is for a new Private Topic (null: work it out, or assume false if $is_starter evaluates to false)
* @param boolean $insert_comcode_as_admin Whether to explicitly insert the Comcode with admin privileges
* @param ?AUTO_LINK $parent_id Parent post ID (null: none-threaded/root-of-thread)
* @return AUTO_LINK The ID of the new post
*/
function cns_make_post(int $topic_id, string $title, string $post, int $skip_sig = 0, ?bool $is_starter = false, ?int $validated = null, int $is_emphasised = 0, ?string $poster_name_if_guest = null, ?string $ip_address = null, ?int $time = null, ?int $poster = null, ?int $whisper_to_member = null, ?int $last_edit_time = null, ?int $last_edit_member = null, bool $check_permissions = true, bool $update_caching = true, ?int $forum_id = null, bool $support_attachments = true, ?string $topic_title = '', ?int $id = null, bool $anonymous = false, bool $skip_post_checks = false, ?bool $is_pt = false, bool $insert_comcode_as_admin = false, ?int $parent_id = null) : int
* Add a post.
*
* @param AUTO_LINK $topic_id The ID of the topic to add the post to
* @param SHORT_TEXT $title The title of the post (may be blank)
* @param LONG_TEXT $post The post
* @param BINARY $skip_sig Whether to skip showing the posters signature in the post
* @param ?boolean $is_starter Whether the post is the first in the topic (null: work it out)
* @param ?BINARY $validated Whether the post is validated (null: unknown, find whether it needs to be not validated initially)
* @param BINARY $is_emphasised Whether the post is marked emphasised
* @param ?string $poster_name_if_guest The name of the person making the post (null: username of current member)
* @param ?IP $ip_address The IP address the post is to be made under (null: IP of current user)
* @param ?TIME $time The time of the post (null: now)
* @param ?MEMBER $poster The poster (null: current member)
* @param ?MEMBER $whisper_to_member The member that this post is intended solely for (null: public)
* @param ?TIME $last_edit_time The last edit time of the post (null: never edited)
* @param ?MEMBER $last_edit_member The member that was last to edit the post (null: never edited)
* @param boolean $check_permissions Whether to check permissions for whether the post may be made as it is given
* @param boolean $update_caching Whether to update the caches after making the post
* @param ?AUTO_LINK $forum_id The forum the post will be in (null: find out from the DB)
* @param boolean $support_attachments Whether to allow attachments in this post
* @param ?string $topic_title The title of the topic (null: find from the DB)
* @param ?AUTO_LINK $id Force an ID (null: don't force an ID)
* @param boolean $anonymous Whether to make the post anonymous
* @param boolean $skip_post_checks Whether to skip post checks
* @param ?boolean $is_pt Whether this is for a new Private Topic (null: work it out, or assume false if $is_starter evaluates to false)
* @param boolean $insert_comcode_as_admin Whether to explicitly insert the Comcode with admin privileges
* @param ?AUTO_LINK $parent_id Parent post ID (null: none-threaded/root-of-thread)
* @return AUTO_LINK The ID of the new post
*/
function cns_make_post(int $topic_id, string $title, string $post, int $skip_sig = 0, ?bool $is_starter = false, ?int $validated = null, int $is_emphasised = 0, ?string $poster_name_if_guest = null, ?string $ip_address = null, ?int $time = null, ?int $poster = null, ?int $whisper_to_member = null, ?int $last_edit_time = null, ?int $last_edit_member = null, bool $check_permissions = true, bool $update_caching = true, ?int $forum_id = null, bool $support_attachments = true, ?string $topic_title = '', ?int $id = null, bool $anonymous = false, bool $skip_post_checks = false, ?bool $is_pt = false, bool $insert_comcode_as_admin = false, ?int $parent_id = null) : int
