list_topic_posts
Purpose: Returns posts from a topic.
Availability: IPB SDK 0.5
Returns posts from topicid in a multi-dimensional array. You can change the number of posts, order, and starting point by specifying filter.
topicid accepts:
- int Topic ID of a Topic
- array Array of Topic IDs
- the string * for All Topics
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: "pid", "author_id", "author_name", "post_date", "post" 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:
[0] => Array (
[pid] => 2
[append_edit] => 0
[edit_time] =>
[author_id] => 0
[author_name] => Guest_weebl
[use_sig] => 1
[use_emo] => 1
[ip_address] => 127.0.0.1
[post_date] => 1082968226
[icon_id] => 0
[post] => i like pie
[queued] => 0
[topic_id] => 2
[post_title] =>
[new_topic] => 1
[edit_name] =>
[post_parent] => 0
[post_key] => 0
[post_htmlstate] => 0
[forum_id] => 1
[attach_id] =>
[attach_hits] =>
[attach_ext] =>
[attach_location] =>
[attach_file] =>
[usedohtml] => 0
)
[1] => Array (
[pid] => 3
[append_edit] => 0
[edit_time] => 1082990031
[author_id] => 0
[author_name] => Guest_Kevin
[use_sig] => 1
[use_emo] => 1
[ip_address] => 127.0.0.1
[post_date] => 1082989963
[icon_id] => 0
[post] => i love bob
[queued] => 0
[topic_id] => 2
[post_title] =>
[new_topic] => 0
[edit_name] =>
[post_parent] => 0
[post_key] => 0
[post_htmlstate] => 0
[forum_id] => 1
[attach_id] =>
[attach_hits] =>
[attach_ext] =>
[attach_location] =>
[attach_file] =>
[usedohtml] => 0
)
)
$posts = $SDK->list_topic_posts ("43", array("limit" => "10", "start" => "0", "order" => "asc", "orderby" => "post_date"), "0");
// Grab last 5 posts from topic 666
$posts = $SDK->list_topic_posts ("666", array("limit" => "5", "start" => "0", "order" => "desc", "orderby" => "post_date"), "0");
// Grab posts 10-18 from topic 1337 ordering by author name
$posts = $SDK->list_topic_posts ("1337", array("limit" => "8", "start" => "10", "order" => "asc", "orderby" => "author_name"), "0");
// Grab first post from topic 2003 bypassing permissions ordering by the author's user id
$posts = $SDK->list_topic_posts ("2003", array("limit" => "1", "start" => "0", "order" => "asc", "orderby" => "author_id"), "1");
// Grab 10 random posts from topic 1791 bypassing permissions (useful for random quotes, facts, etc.)
$posts = $SDK->list_topic_posts ("1791", array("limit" => "1", "start" => "0", "order" => "asc", "orderby" => "random"), "1");
// Grab 1 random post from anywhere
$posts = $SDK->list_topic_posts ("*", array("limit" => "1", "start" => "0", "order" => "asc", "orderby" => "random"));
User Contributed Notes
Documentation Generated at Sat, 16 Apr 2005 07:36:35 -0700
Find the latest version at http://ipbsdk.sourceforge.net
There are currently no user contributed notes for this page.