Function Forum_driver_smf2->make_post_forum_topic

Definitions

sources/forum/smf2.php

  • Makes a post in the specified forum, in the specified topic according to the given specifications. If the topic doesn't exist, it is created along with a spacer-post.Spacer posts exist in order to allow staff to delete the first true post in a topic. Without spacers, this would not be possible with most forum systems. They also serve to provide meta information on the topic that cannot be encoded in the title (such as a link to the content being commented upon).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$forum_name SHORT_TEXT No No required parameter N/A N/A The forum name
$topic_identifier SHORT_TEXT No No required parameter N/A N/A The topic identifier (usually <content-type>_<content-id>)
$member_id MEMBER No No required parameter N/A N/A The member ID
$post_title LONG_TEXT No No required parameter N/A N/A The post title
$post LONG_TEXT No No required parameter N/A N/A The post content in Comcode format
$content_title string No No required parameter N/A N/A The topic title; must be same as content title if this is for a comment topic
$topic_identifier_encapsulation_prefix string No No required parameter N/A N/A This is put together with the topic identifier to make a more-human-readable topic title or topic description (hopefully the latter and a $content_title title, but only if the forum supports descriptions)
$content_url ?URLPATH No No Null N/A N/A URL to the content (null: do not make spacer post)
$time ?TIME No No Null N/A N/A The post time (null: use current time)
$ip ?IP No No Null N/A N/A The post IP address (null: use current members IP address)
$validated ?BINARY No No Null N/A N/A Whether the post is validated (null: unknown, find whether it needs to be marked not validated initially). This only works with the Conversr driver.
$topic_validated ?BINARY No No 1 N/A N/A Whether the topic is validated (null: unknown, find whether it needs to be marked not validated initially). This only works with the Conversr driver.
$skip_post_checks boolean No No False N/A N/A Whether to skip post checks
$poster_name_if_guest SHORT_TEXT No No Blank (empty string) N/A N/A The name of the poster
$parent_id ?AUTO_LINK No No Null N/A N/A ID of post being replied to (null: N/A)
$staff_only boolean No No False N/A N/A Whether the reply is only visible to staff

Returns

  • Topic ID (may be null), and whether a hidden post has been made
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Makes a post in the specified forum, in the specified topic according to the given specifications. If the topic doesn't exist, it is created along with a spacer-post.Spacer posts exist in order to allow staff to delete the first true post in a topic. Without spacers, this would not be possible with most forum systems. They also serve to provide meta information on the topic that cannot be encoded in the title (such as a link to the content being commented upon).
 *
 * @param  SHORT_TEXT $forum_name The forum name
 * @param  SHORT_TEXT $topic_identifier The topic identifier (usually <content-type>_<content-id>)
 * @param  MEMBER $member_id The member ID
 * @param  LONG_TEXT $post_title The post title
 * @param  LONG_TEXT $post The post content in Comcode format
 * @param  string $content_title The topic title; must be same as content title if this is for a comment topic
 * @param  string $topic_identifier_encapsulation_prefix This is put together with the topic identifier to make a more-human-readable topic title or topic description (hopefully the latter and a $content_title title, but only if the forum supports descriptions)
 * @param  ?URLPATH $content_url URL to the content (null: do not make spacer post)
 * @param  ?TIME $time The post time (null: use current time)
 * @param  ?IP $ip The post IP address (null: use current members IP address)
 * @param  ?BINARY $validated Whether the post is validated (null: unknown, find whether it needs to be marked not validated initially). This only works with the Conversr driver.
 * @param  ?BINARY $topic_validated Whether the topic is validated (null: unknown, find whether it needs to be marked not validated initially). This only works with the Conversr driver.
 * @param  boolean $skip_post_checks Whether to skip post checks
 * @param  SHORT_TEXT $poster_name_if_guest The name of the poster
 * @param  ?AUTO_LINK $parent_id ID of post being replied to (null: N/A)
 * @param  boolean $staff_only Whether the reply is only visible to staff
 * @return array Topic ID (may be null), and whether a hidden post has been made
 */

public function make_post_forum_topic(string $forum_name, string $topic_identifier, int $member_id, string $post_title, string $post, string $content_title, string $topic_identifier_encapsulation_prefix, ?string $content_url = null, ?int $time = null, ?string $ip = null, ?int $validated = null, ?int $topic_validated = 1, bool $skip_post_checks = false, string $poster_name_if_guest = '', ?int $parent_id = null, bool $staff_only = false) : array