ssi_recentPosts

Description

Gets a list of recent posts and either displays them or returns an array of info depending on output_method.

Syntax

array ssi_recentPosts ([int $num_recent[, array $exclude_boards[, array $include_boards[, string $output_method]]]])



Parameter $num_recent

Expected type: Integer
Description: The number of recent posts to fetch. Defaults to 8



Parameter $exclude_boards

Expected type: Array of Integers
Description: An array of IDs for boards that you don't want to pull recent posts from



Parameter $include_boards

Expected type: Array of Integers
Description: An array of IDs for boards that you want recent posts to be pulled from



Parameter $output_method

Expected type: String
Description: Standard output_method - if not specified, the function will output a nice formatted list, otherwise it will return the array of information. If there are no recent posts, an empty array is returned.



Return value

Expected type: Array
Description: Returns nothing if output_method is echo; otherwise returns an array of arrays with the following keys

Array Elements
Key Optional Expected type Description
board no Array An array of information about the board - id (board ID), name (board name), href (URL to the board) and link (HTML link to the board)
href no String URL to the post
link no String HTML link to the post
new no Boolean Whether or not this is a new post
newTime no Integer Used to determine which posts within the topic to mark read
poster no Array An array of information about the poster - id (member ID or 0 if they're a guest), name (poster's name), href (URL to the poster's profile, if applicable), link (HTML link to the poster's profile, or the name if they're a guest)
short_subject no String The first 22 characters of the subject with "..." appended, or the entire subject if it's less than 26 characters long
subject no String The subject of this post
time no String The formatted time/date string indicating when the post was made
timestamp no Integer The raw timestamp indicating when the post was made
topic no Integer The topic ID


Notes

  • If output_method is echo, will display a pre-formatted list
  • Does not care if all the recent posts are from the same board...
  • The system defaults to pulling only the most recent 125 posts before parsing this function. Of those 125 posts, this function then compares that the posts a) are NOT in the exclude board list, b) ARE in the include board list and c) are in a board which the current user has permissions to view. [This means that you MAY get less than the requested number of posts displayed.]
Advertisement: