I would like to edit this block to make it more customized for its purpose.
I need to edit the sp_recentPosts to make it so it shows the last 6 to 10 posts from a certain category.
The forum category is 26.0, and I need the block to show the lastest posts 6-10 in that category.
When I say 6 through 10, I mean I do not want the first 5 lastest posts from that category, I want 6-10. 1-5 is already shown on the front page under the board news.
Here's what I have so far:
function sp_recentPosts($parameters, $id, $return_parameters = false)
{
global $txt, $scripturl, $settings, $color_profile;
$block_parameters = array(
'limit' => 'int',
'type' => 'select',
);
if ($return_parameters)
return $block_parameters;
$limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
$type = 'ssi_recentTopics';
$items = $type($limit, null, null, 'array');
if (empty($items))
{
echo '
', $txt['error_sp_no_posts_found'];
return;
}
else
$items[count($items) - 1]['is_last'] = true;
$colorids = array();
foreach ($items as $item)
$colorids[] = $item['poster']['id'];
if (!empty($colorids) && sp_loadColors($colorids) !== false)
{
foreach ($items as $k => $p)
{
if (!empty($color_profile[$p['poster']['id']]['link']))
$items[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link'];
}
}
foreach ($items as $key => $item)
echo '
<a href="', $item['href'], '">', $item['subject'], '</a> <span class="smalltext">', '<br />[', $item['time'], ']</span><br />', empty($item['is_last']) ? '<hr />' : '';
}