Function __global->add_news

Definitions

sources/news2.php

  • Adds a news entry to the database, and send out the news to any RSS cloud listeners.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$title SHORT_TEXT No No required parameter N/A N/A The news title
$news LONG_TEXT No No required parameter N/A N/A The news summary (or if not an article, the full news)
$author ?ID_TEXT No No Null N/A N/A The news author (possibly, a link to an existing author in the system, but does not need to be) (null: current username)
$validated BINARY No No 1 N/A N/A Whether the news has been validated
$allow_rating BINARY No No 1 N/A N/A Whether the news may be rated
$allow_comments SHORT_INTEGER No No 1 N/A N/A Whether comments are allowed (0=no, 1=yes, 2=review style)
$allow_trackbacks BINARY No No 1 N/A N/A Whether the news may have trackbacks
$notes LONG_TEXT No No Blank (empty string) N/A N/A Notes for the news
$news_article LONG_TEXT No No Blank (empty string) N/A N/A The news entry (blank means no entry)
$main_news_category ?AUTO_LINK No No Null N/A N/A The primary news category (null: personal)
$news_categories array No No [] N/A N/A The IDs of the news categories that this is in
$time ?TIME No No Null N/A N/A The time of submission (null: now)
$submitter ?MEMBER No No Null N/A N/A The news submitter (null: current member)
$views integer No No 0 N/A N/A The number of views the article has had
$edit_date ?TIME No No Null N/A N/A The edit date (null: never)
$id ?AUTO_LINK No No Null N/A N/A Force an ID (null: don't force an ID)
$image URLPATH No No Blank (empty string) N/A N/A URL to the image for the news entry (blank: use cat image)
$meta_keywords ?SHORT_TEXT No No Blank (empty string) N/A N/A Meta keywords for this resource (null: do not edit) (blank: implicit)
$meta_description ?LONG_TEXT No No Blank (empty string) N/A N/A Meta description for this resource (null: do not edit) (blank: implicit)
$regions array No No [] N/A N/A The regions (empty: not region-limited)

Returns

  • The ID of the news just added
  • Type: AUTO_LINK
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Adds a news entry to the database, and send out the news to any RSS cloud listeners.
 *
 * @param  SHORT_TEXT $title The news title
 * @param  LONG_TEXT $news The news summary (or if not an article, the full news)
 * @param  ?ID_TEXT $author The news author (possibly, a link to an existing author in the system, but does not need to be) (null: current username)
 * @param  BINARY $validated Whether the news has been validated
 * @param  BINARY $allow_rating Whether the news may be rated
 * @param  SHORT_INTEGER $allow_comments Whether comments are allowed (0=no, 1=yes, 2=review style)
 * @param  BINARY $allow_trackbacks Whether the news may have trackbacks
 * @param  LONG_TEXT $notes Notes for the news
 * @param  LONG_TEXT $news_article The news entry (blank means no entry)
 * @param  ?AUTO_LINK $main_news_category The primary news category (null: personal)
 * @param  array $news_categories The IDs of the news categories that this is in
 * @param  ?TIME $time The time of submission (null: now)
 * @param  ?MEMBER $submitter The news submitter (null: current member)
 * @param  integer $views The number of views the article has had
 * @param  ?TIME $edit_date The edit date (null: never)
 * @param  ?AUTO_LINK $id Force an ID (null: don't force an ID)
 * @param  URLPATH $image URL to the image for the news entry (blank: use cat image)
 * @param  ?SHORT_TEXT $meta_keywords Meta keywords for this resource (null: do not edit) (blank: implicit)
 * @param  ?LONG_TEXT $meta_description Meta description for this resource (null: do not edit) (blank: implicit)
 * @param  array $regions The regions (empty: not region-limited)
 * @return AUTO_LINK The ID of the news just added
 */

function add_news(string $title, string $news, ?string $author = null, int $validated = 1, int $allow_rating = 1, int $allow_comments = 1, int $allow_trackbacks = 1, string $notes = '', string $news_article = '', ?int $main_news_category = null, array $news_categories = [], ?int $time = null, ?int $submitter = null, int $views = 0, ?int $edit_date = null, ?int $id = null, string $image = '', ?string $meta_keywords = '', ?string $meta_description = '', array $regions = []) : int