I have this custom code for recent posts that i got from here somewhere, i can't find the thread......
I have installed a new Prefix Mod, the Prefix doesnt show up in this Recent Post Block. Can anyone help me with the code to get the Prefix to show up?
global $txt, $scripturl, $settings, $context, $color_profile;
$boards = null;
$limit = 25;
$type = 'ssi_recentTopics'; // Can also be 'ssi_recentPosts' for recent posts.
$display = 'compact'; // Could also be 'compact' for showing on the left and right sides. Although it doesn't work as well.
$items = $type($limit, null, $boards, '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'];
}
}
echo '<div style="overflow:auto; height:520px; width:190px">';
if ($display == 'compact')
{
foreach ($items as $key => $item)
echo '
<a href="', $item['href'], '">', $item['subject'], '</a> <span class="smalltext">', $txt['by'], ' ', $item
['poster']['link'], $item['new'] ? '' : ' <a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new" rel="nofollow"><img src="' .
$settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '<br />[', $item['time'], ']</span><br />', empty($item['is_last']) ? '<hr />' : '';
}
elseif ($display == 'full')
{
echo '
<table class="sp_fullwidth">';
foreach ($items as $item)
echo '
<tr>
<td class="sp_recent_icon sp_center">
', sp_embed_image(empty($parameters['type']) ? 'post' : 'topic'), '
</td>
<td class="sp_recent_subject">
<a href="', $item['href'], '">', $item['subject'], '</a>
', $item['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' .
$item['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '<br
/>[', $item['board']['link'], ']
</td>
<td class="sp_recent_info sp_right">
', $item['poster']['link'], '<br />', $item['time'], '
</td>
</tr>';
echo '
</table>';
}
echo '</div>';
This is the code from the guy who developed the Prefix Mod. He told me to use this in a custom php block, it works as in the prefix shows up but it's not as neat and as easy to read like the one above.
global $sourcedir;
require_once($sourcedir.'/TopicPrefixPortal.php');
prefix_recent_topics($topics = 5, $showBoard = null, $exclude_boards = null, $include_boards = null);