Introduction   Getting Started   Upgrading   Function Reference   Changelog   Support and Feedback

list_forum_topics

Usage: array list_forum_topics (mixed forumid[, array filter[, bool bypassperms]])
Purpose: Returns topics from a forum.
Availability: IPB SDK 0.5

Returns topics from forum forumid in a multi-dimensional array. You can change the number of topics, order, and starting point by specifying a filter argument. filter accepts three arguments: order, limit and start.

The first argument forumid accepts:

If bypassperms is set to TRUE, the permissions check to check the currently logged in user can view that forum will be bypassed.

The array filter accepts the following elements elements: order, limit and start. As of IPB SDK 0.5.1, it will also accept orderby. order accepts either the value "DESC" and "ASC". limit and start accept integers. orderby accepts the following values: "tid", "title", "posts", "starter_name", "starter_id", "start_date", "last_post", "views", "post_date" or "random".

If bypassperms is set to TRUE, the permissions check to check the currently logged in user can view that topic will be bypassed.

If the user does not have permissions FALSE will be returned.

Information will be returned in the following array structure:

Array (
      [0] => Array (
            [tid] => 58
            [title] => Hopefully works
            [description] => yup
            [state] => open
            [posts] => 0
            [starter_id] => 1
            [start_date] => 1082968226
            [last_poster_id] => 1
            [last_post] => 1096280362
            [icon_id] => 0
            [starter_name] => Pita
            [last_poster_name] => Pita
            [poll_state] => 0
            [last_vote] => 0
            [views] => 1
            [forum_id] => 1
            [approved] => 1
            [author_mode] => 1
            [pinned] => 0
            [moved_to] =>
            [rating] =>
            [total_votes] => 0
            [topic_hasattach] => 0
            [topic_firstpost] => 2
            [topic_queuedposts] => 0
            [pid] => 2
            [append_edit] => 0
            [edit_time] =>
            [author_id] => 1
            [author_name] => Pita
            [use_sig] => 1
            [use_emo] => 1
            [ip_address] => 12.0.0.1
            [post_date] => 1082968226
            [post] => this had better work
            [queued] => 0
            [topic_id] => 2
            [post_title] =>
            [new_topic] => 1
            [edit_name] =>
            [post_parent] => 0
            [post_key] => 0
            [post_htmlstate] => 0
            [usedohtml] => 0
      )
)

// Grab last 10 topics from forum 1 ordered by post date
$posts = list_forum_topics ("1", array("limit" => "10", "start" => "0", "order" => "desc", "orderby" => "post_date"), "0");

// Grab first 5 topics from forum 7 bypassing permissions ordered by post date
$posts = list_forum_topics ("7", array("limit" => "5", "start" => "0", "order" => "asc", "orderby" => "post_date"), "0");

// Grab 10 random topics from forum 12 bypassing permissions
$posts = list_forum_topics ("12", array("limit" => "10", "start" => "0", "orderby" => "random"), "0");
See Also: list_topic_posts


User Contributed Notes

CodeOptimist
If limit is not specified, it defaults to 15. If every topic in a forum needs to be returned at once, make sure limit is set to a high enough number.

Documentation Generated at Sat, 16 Apr 2005 07:36:35 -0700
Find the latest version at http://ipbsdk.sourceforge.net