sp_RecentPostList

Important Note:  The contents of this document applies ONLY to version 5.x.x of Simple:Press.  It likely does NOT apply to version 6.x.x (our latest version).

Description

sp_RecentPostList() – Displays the recent post list (as used on front page, Group View, by default).

Usage

sp_RecentPostList($args=”, $label=”);

Arguments

Note: If the value of any of this function’s arguments/parameters or the placement of this function in standard supplied Simple:Press theme pages is to be changed, it is highly recommended that a Child Theme or a Custom Theme be developed to accept the changes.

$args – List of arguments for controlling display.
Type:
(string) (optional)
Default:
‘tagId’ => ‘spRecentPostList’
‘tagClass’ => ‘spRecentPostSection’
‘labelClass’ => ‘spMessage’
‘template’ => ‘spListView.php’
‘show’ => 20
‘group’ => 0
‘admins’ => 0
‘mods’ => 1
‘first’ => 0
‘get’ => 0

tagId‘: CSS ID for Div.
tagClass‘: CSS Class for Div.
labelClass‘: CSS class for Label before content is displayed.
template‘: Template used to display info.
show‘: Number of new posts to show.
‘group’: Flag to indicate whether to display the recent posts grouped by forum or just by date. One (1) is true and the recent posts are displayed grouped by forum. Zero (0) is false and the posts are not displayed grouped by forum, but by date.
admins‘: Flag to indicate whether or not to display the posts to Administrators. One (1) is true and the posts are displayed to the Administrators. Zero (0) is false and posts are not displayed to them.
mods‘: Flag to indicate whether or not to display the posts to Moderators. One (1) is true and the posts are displayed to the Moderators. Zero (0) is false and posts are not displayed to them.
‘first’: Flag to indicate whether to display summary information from the first post in the topic with the recent post in addition to the normal summary information from the last post in the topic. One (1) is true and the summary information from the first and last post in the topic are displayed. Zero (0) is false and only the last post summary information is displayed.

Note: The effect of ‘first’ = 1 (one / true) can only be seen if a modification to the active theme’s ‘spListView.php‘ file is made to add a call to the ‘sp_ListFirstPost()‘ function if the function call is not already in the file. See the Special Notes section of this page for more information.

get‘: Flag to indicate whether to short circuit the template tag display process and simply return data or to proceed with normal HTML display code generation. One (1) is true and the template tag display process is not done and data is returned. Zero (0) is false and normal html display code generation happens.

$label – Text displayed before the topics are displayed (title).
Type:
(string) (optional)
Default:
None

 

Special Notes

In most standard supplied Simple:Press themes this is used in the main forum page (‘spGroupView.php’) after the groups and forums are displayed but can be used elsewhere on a forum page. In the “Reboot” and the “Sp-Reboot” themes this function is used in the ‘spGroupViewDesktop.php’ file instead of the ‘spGroupView.php’ file.

In the standard supplied Simple:Press themes,the default items displayed for each recent post shown on the unmodified “Group View” page are:

  • the Forum Title where the post resides.
  • the Topic Title.
  • information about the last post in the topic consisting of:
    • the message “Last Post”.
    • an icon when hovered over shows the starting text of the last post.
    • the username of the author of the post.
    • an indicator of how long ago the post was made.

Setting ‘first’ equal to 1 (one / true) makes it possible to add information regarding the first (1st) post in the topic having a recent post.

Note: The effect of ‘first’ = 1 (true) can only be seen if a modification to the theme’s ‘spListView.php‘ file is made to add the ‘sp_ListFirstPost()‘ function if the function call is not already in the file. See Example 3 below for details.
  • information added about the first post in the topic might consist of:
    • the message “First Post”.
    • an icon when hovered over shows the starting text of the first post.
    • the username of the author of the post.
    • an indicator of how long ago the post was made.

Examples

1). Display the recent posts list showing a maximum of 10 with the text “Unread and recently updated topics” as the title. If this call would modify a standard supplied Simple:Press theme’s file, it is highly recommended that a child theme be developed to accept the change. See example 3 for a brief discussion keeping in mind to substitute the name of the desired parent theme and file for those in the example.

sp_RecentPostList('show=10', __sp('Unread and recently updated topics'));

2). Display the recent posts list showing a maximum of 25, displaying to admins and with the text “Latest topics” as the title. If this call would modify a standard supplied Simple:Press theme’s file, it is highly recommended that a child theme be developed to accept the change. See example 3 for a brief discussion keeping in mind to substitute the name of the desired parent theme and file for those in the example.

sp_RecentPostList('show=25&admins=1', __sp('Latest topics'));

3). Using the child theme based on the “Default” theme, display the standard unread and recently updated topic list, but in addition add summary information regarding the first (1st) post in the topic containing the recent post to each recent post shown on the “Group View” page.

A. Download the Default Child Framework and set it up as discussed in the Creating a Child Theme page. Copy the Default theme’s ‘spGroupView.php’ file over to the child theme and modify its “sp_RecentPostList()’ call to add “&first=1” as shown below and save.

sp_RecentPostList('show=10&first=1', __sp('Unread and recently updated topics'));

B. Copy the Default theme’s ‘spListView.php’ file from the ‘template’ folder over to the child theme, and then in the file’s ‘list’ section find where the topic and last post information are being set up as shown immediately below.

sp_ListTopicName('', __sp('Browse the thread %NAME%'));
sp_ListLastPost('iconClass=spIcon spLeft&height=0px', __sp('Last Post'));

Modify it to add the call to ‘spListFirstPost()’ as shown below and save.

sp_ListTopicName('', __sp('Browse the thread %NAME%'));
sp_ListFirstPost('iconClass=spIcon spLeft&height=0px', __sp('First Post'));
sp_ListLastPost('iconClass=spIcon spLeft&height=0px', __sp('Last Post'));

Actions and Hooks Used in Template Tag

  • apply_filters(‘sph_RecentPostList_args’, $a) – Allows modification of the arguments to the template tag. $a contains the parsed arguments.

Changelog

Since Simple:Press version 5.0.

Codex page sync’d to code version 5.5.8.

Source Code

sp_RecentPostList() is located in simple-press/forum/content/sp-common-view-functions.php.

Related

sp_ForumIndexStatusIcons
sp_UnreadPostsInfo

Posted in