There used to be a mod that sorted the Unread Replies by category/forum.
Does anybody know how to do the same thing with SMF 2?
Anyone? Anyone? Beuller? Beuller?
So what mod are you talking about?
Quote from: Arantor on January 21, 2010, 08:59:41 PM
So what mod are you talking about?
That is part of the problem, I don't know what the name of the mod was (heck, it could have been a manual tweak originally, it was that long ago). I know that when I have done updates since then, I have had to go in and manually change the recent.php and recent.template.php files to get it to continue on my forums.
Here is a screenshot of what the output looks like
SO anybody have any ideas of how to do this in SMF 2?
Beuller? Beuller? Anyone? Anyone?
Is there anybody out there that can help me? That can tell me what I need to do in order to make my Unread Topics be sorted as shown in the image a few posts up?
Sorry for the delayed response.
I do not believe this mod is still available, you make make another mod request for it though.
I will make a request, but in the meantime, can anybody tell me what sort of code changes I would need to make in order to make it work?
I think that I figured it out.....
I made no changes to the recent.php from the sources directory, but I did change the code in the recent.template.php (from the Core theme, the next step is to try it on the other themes that have a recent.template.php file).
I isolated the following code from the template_unread function
foreach ($context['topics'] as $topic)
{
// Calculate the color class of the topic.
$color_class = '';
if (strpos($topic['class'], 'sticky') !== false)
$color_class = 'stickybg';
if (strpos($topic['class'], 'locked') !== false)
$color_class .= 'lockedbg';
$color_class2 = !empty($color_class) ? $color_class . '2' : '';
echo '
<tr>
<td class="', $color_class, ' icon1 windowbg">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>
<td class="', $color_class, ' icon2 windowbg">
<img src="', $topic['first_post']['icon_url'], '" alt="" />
</td>
<td class="subject ', $color_class2, ' windowbg2">
<div>
', $topic['is_sticky'] ? '<strong>' : '', '<span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span>', $topic['is_sticky'] ? '</strong>' : '' ,'
<a href="', $topic['new_href'], '" id="newicon', $topic['first_post']['id'], '"><img src="', $settings['lang_images_url'], '/new.gif" alt="', $txt['new'], '" /></a>
<p>
', $txt['started_by'], ' <strong>', $topic['first_post']['member']['link'], '</strong>
', $txt['in'], ' <em>', $topic['board']['link'], '</em>
<small id="pages', $topic['first_post']['id'], '">', $topic['pages'], '</small>
</p>
</div>
</td>
<td class="', $color_class, ' stats windowbg">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>
<td class="', $color_class2, ' lastpost windowbg2">
<a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" style="float: right;" /></a>
', $topic['last_post']['time'], '<br />
', $txt['by'], ' ', $topic['last_post']['member']['link'], '
</td>';
if ($showCheckboxes)
echo '
<td class="windowbg2" valign="middle" align="center">
<input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" />
</td>';
echo '
</tr>';
and I changed it to the following:
$boards = array();
foreach ($context['topics'] as $topic)
$boards[$topic['board']['id']] = $topic['board'];
foreach ($boards as $board)
{
echo '
<tr class="catbg">
<td colspan="8">', $board['link'], '</td>
</tr>';
foreach ($context['topics'] as $topic)
{
if ($topic['board']['id'] != $board['id'])
continue;
echo '
<tr>
<td class="windowbg2" valign="middle" align="center" width="6%">
<img src="' . $settings['images_url'] . '/topic/' . $topic['class'] . '.gif" alt="" />
</td><td class="windowbg2" valign="middle" align="center" width="4%">
<img src="' . $topic['first_post']['icon_url'] . '" alt="" align="middle" />
</td><td class="windowbg' , $topic['is_sticky'] && !empty($settings['seperate_sticky_lock']) ? '3' : '' , '" width="48%" valign="middle">' , $topic['is_locked'] && !empty($settings['seperate_sticky_lock']) ? '
<img src="' . $settings['images_url'] . '/icons/quick_lock.gif" align="right" alt="" style="margin: 0;" />' : '' , $topic['is_sticky'] && !empty($settings['seperate_sticky_lock']) ? '
<img src="' . $settings['images_url'] . '/icons/show_sticky.gif" align="right" alt="" style="margin: 0;" />' : '', $topic['first_post']['link'], ' <a href="', $topic['new_href'], '"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" /></a> <span class="smalltext">', $topic['pages'], '</span></td>
<td class="windowbg2" valign="middle" width="14%">
', $topic['first_post']['member']['link'], '</td>
<td class="windowbg" valign="middle" width="4%" align="center">
', $topic['replies'], '</td>
<td class="windowbg" valign="middle" width="4%" align="center">
', $topic['views'], '</td>
<td class="windowbg2" valign="middle" width="22%">
<a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" style="float: right;" /></a>
<span class="smalltext">
', $topic['last_post']['time'], '<br />
', $txt[525], ' ', $topic['last_post']['member']['link'], '
</span>
</td>';
if ($showCheckboxes)
echo '
<td class="windowbg2" valign="middle" align="center">
<input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" />
</td>';
echo'
</tr>';
}
This is the same code from my SMF 1.1.11 version of sorting the unread with a few minor tweaks (there is an extra column in there for the checkboxes, and the checkboxes themselves).
And it is appearing to work.....
Cool, glad you got it working, if this is solved, please feel free to mark this solved. :)