Function __global->add_download

Definitions

sources/downloads2.php

  • Add a download.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$category_id AUTO_LINK No No required parameter N/A N/A The ID of the category the download is to be in
$name SHORT_TEXT No No required parameter N/A N/A The name of the download
$url URLPATH No No required parameter N/A N/A The URL to the download
$description LONG_TEXT No No required parameter N/A N/A The description of the download
$author ID_TEXT No No required parameter N/A N/A The author of the download (not necessarily same as the submitter)
$additional_details LONG_TEXT No No required parameter N/A N/A The supplementary description for the download
$out_mode_id ?AUTO_LINK No No required parameter N/A N/A The out-mode-id (the ID of a download that this download is an old version of). Often people wonder why this is specified with the old version, and not the opposite with the new version - it is because statistically, we perceive more chance of downloads merging than splitting (null: none)
$validated BINARY No No required parameter N/A N/A Whether the download has been validated
$allow_rating BINARY No No required parameter N/A N/A Whether the download may be rated
$allow_comments SHORT_INTEGER No No required parameter N/A N/A Whether comments are allowed (0=no, 1=yes, 2=review style)
$allow_trackbacks BINARY No No required parameter N/A N/A Whether the download may be trackbacked
$notes LONG_TEXT No No required parameter N/A N/A Hidden notes pertaining to the download
$original_filename SHORT_TEXT No No required parameter N/A N/A The downloads original filename (the URL may be obfuscated)
$file_size integer No No required parameter N/A N/A The file size of the download (we can't really detect this in real-time for remote URLs)
$cost integer No No 0 N/A N/A The cost of the download that members will have to pay to get it
$submitter_gets_points BINARY No No 0 N/A N/A Whether the submitter gets the points for the download (they are selling it) (otherwise they are just thrown out, which is an alternative model - one of enforcing community point building)
$licence ?AUTO_LINK No No Null N/A N/A The licence to use (null: none)
$add_date ?TIME No No Null N/A N/A The add date for the download (null: now)
$num_downloads integer No No 0 N/A N/A The number of downloads that this download has had
$views integer No No 0 N/A N/A The number of views that this download has had
$submitter ?MEMBER No No Null N/A N/A The submitter (null: current user)
$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)
$meta_keywords SHORT_TEXT No No Blank (empty string) N/A N/A Meta keywords for this resource (blank: implicit)
$meta_description LONG_TEXT No No Blank (empty string) N/A N/A Meta description for this resource (blank: implicit)

Returns

  • The ID of the newly added download
  • Type: AUTO_LINK
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Add a download.
 *
 * @param  AUTO_LINK $category_id The ID of the category the download is to be in
 * @param  SHORT_TEXT $name The name of the download
 * @param  URLPATH $url The URL to the download
 * @param  LONG_TEXT $description The description of the download
 * @param  ID_TEXT $author The author of the download (not necessarily same as the submitter)
 * @param  LONG_TEXT $additional_details The supplementary description for the download
 * @param  ?AUTO_LINK $out_mode_id The out-mode-id (the ID of a download that this download is an old version of). Often people wonder why this is specified with the old version, and not the opposite with the new version - it is because statistically, we perceive more chance of downloads merging than splitting (null: none)
 * @param  BINARY $validated Whether the download has been validated
 * @param  BINARY $allow_rating Whether the download 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 download may be trackbacked
 * @param  LONG_TEXT $notes Hidden notes pertaining to the download
 * @param  SHORT_TEXT $original_filename The downloads original filename (the URL may be obfuscated)
 * @param  integer $file_size The file size of the download (we can't really detect this in real-time for remote URLs)
 * @param  integer $cost The cost of the download that members will have to pay to get it
 * @param  BINARY $submitter_gets_points Whether the submitter gets the points for the download (they are selling it) (otherwise they are just thrown out, which is an alternative model - one of enforcing community point building)
 * @param  ?AUTO_LINK $licence The licence to use (null: none)
 * @param  ?TIME $add_date The add date for the download (null: now)
 * @param  integer $num_downloads The number of downloads that this download has had
 * @param  integer $views The number of views that this download has had
 * @param  ?MEMBER $submitter The submitter (null: current user)
 * @param  ?TIME $edit_date The edit date (null: never)
 * @param  ?AUTO_LINK $id Force an ID (null: don't force an ID)
 * @param  SHORT_TEXT $meta_keywords Meta keywords for this resource (blank: implicit)
 * @param  LONG_TEXT $meta_description Meta description for this resource (blank: implicit)
 * @return AUTO_LINK The ID of the newly added download
 */

function add_download(int $category_id, string $name, string $url, string $description, string $author, string $additional_details, ?int $out_mode_id, int $validated, int $allow_rating, int $allow_comments, int $allow_trackbacks, string $notes, string $original_filename, int $file_size, int $cost = 0, int $submitter_gets_points = 0, ?int $licence = null, ?int $add_date = null, int $num_downloads = 0, int $views = 0, ?int $submitter = null, ?int $edit_date = null, ?int $id = null, string $meta_keywords = '', string $meta_description = '') : int