Advertisement:

Author Topic: Unread Replies  (Read 2063 times)

Offline Rasyr

  • Jr. Member
  • **
  • Posts: 172
Unread Replies
« on: January 21, 2010, 10:30:19 AM »
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?


Offline Rasyr

  • Jr. Member
  • **
  • Posts: 172
Re: Unread Replies
« Reply #1 on: January 21, 2010, 08:55:44 PM »
Anyone? Anyone? Beuller? Beuller?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Unread Replies
« Reply #2 on: January 21, 2010, 08:59:41 PM »
So what mod are you talking about?
No good deed goes unpunished
All helpful urges should be circumvented

Offline Rasyr

  • Jr. Member
  • **
  • Posts: 172
Re: Unread Replies
« Reply #3 on: January 22, 2010, 06:20:28 AM »
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

Offline Rasyr

  • Jr. Member
  • **
  • Posts: 172
Re: Unread Replies
« Reply #4 on: February 10, 2010, 09:22:13 PM »
SO anybody have any ideas of how to do this in SMF 2?

Offline Rasyr

  • Jr. Member
  • **
  • Posts: 172
Re: Unread Replies
« Reply #5 on: February 22, 2010, 09:25:47 AM »
Beuller? Beuller? Anyone? Anyone?

Offline Rasyr

  • Jr. Member
  • **
  • Posts: 172
Re: Unread Replies
« Reply #6 on: February 26, 2010, 10:28:13 PM »
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?


Offline Kill Em All

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,144
  • Gender: Male
  • Something has to go wrong. Just has to.
    • KEAGaming
Re: Unread Replies
« Reply #7 on: February 26, 2010, 10:36:50 PM »
Sorry for the delayed response.

I do  not believe this mod is still available, you make make another mod request for it though.
My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

Offline Rasyr

  • Jr. Member
  • **
  • Posts: 172
Re: Unread Replies
« Reply #8 on: February 26, 2010, 11:44:01 PM »
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?

Offline Rasyr

  • Jr. Member
  • **
  • Posts: 172
Re: Unread Replies
« Reply #9 on: February 27, 2010, 12:08:48 PM »
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

Code: [Select]
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:

Code: [Select]
$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.....




Offline Kill Em All

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,144
  • Gender: Male
  • Something has to go wrong. Just has to.
    • KEAGaming
Re: Unread Replies
« Reply #10 on: February 27, 2010, 03:08:36 PM »
Cool, glad you got it working, if this is solved, please feel free to mark this solved. :)
My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.