Function __global->cns_get_forum_tree

Definitions

sources/cns_forums2.php

  • Get a list of maps containing all the subforums, and path information, of the specified forum - and those beneath it, recursively.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$member_id ?MEMBER No No Null N/A N/A The member that the view privileges are done for (null: current member)
$base_forum ?AUTO_LINK No No Null N/A N/A The forum we are starting from (null: capture the whole tree)
$breadcrumbs string No No Blank (empty string) N/A N/A The breadcrumbs at this point of the recursion (blank for the start)
$skip ?AUTO_LINK No No Null N/A N/A ID of a forum to skip display/recursion for (null: none)
$forum_details ?array No No Null N/A N/A Details of the current forum in the recursion (null: find from DB)
$use_compound_list boolean No No False N/A N/A Whether to generate a compound list (a list of all the ancestors, for each point in the forum tree) as well as the tree
$levels ?integer No No Null N/A N/A The number of recursive levels to search (null: all)
$do_stats boolean No No False N/A N/A Whether to generate tree statistics
$updated_since ?TIME No No Null N/A N/A Time from which content must be updated (null: no limit)

Returns

  • A list of maps, OR (if $use_compound_list) a pair of the Tempcode and the compound list, contains more details if stats were requested
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get a list of maps containing all the subforums, and path information, of the specified forum - and those beneath it, recursively.
 *
 * @param  ?MEMBER $member_id The member that the view privileges are done for (null: current member)
 * @param  ?AUTO_LINK $base_forum The forum we are starting from (null: capture the whole tree)
 * @param  string $breadcrumbs The breadcrumbs at this point of the recursion (blank for the start)
 * @param  ?AUTO_LINK $skip ID of a forum to skip display/recursion for (null: none)
 * @param  ?array $forum_details Details of the current forum in the recursion (null: find from DB)
 * @param  boolean $use_compound_list Whether to generate a compound list (a list of all the ancestors, for each point in the forum tree) as well as the tree
 * @param  ?integer $levels The number of recursive levels to search (null: all)
 * @param  boolean $do_stats Whether to generate tree statistics
 * @param  ?TIME $updated_since Time from which content must be updated (null: no limit)
 * @return array A list of maps, OR (if $use_compound_list) a pair of the Tempcode and the compound list, contains more details if stats were requested
 */

function cns_get_forum_tree(?int $member_id = null, ?int $base_forum = null, string $breadcrumbs = '', ?int $skip = null, ?array $forum_details = null, bool $use_compound_list = false, ?int $levels = null, bool $do_stats = false, ?int $updated_since = null) : array