Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Mod Requests => Topic started by: t2noob on May 24, 2009, 05:54:38 PM

Title: Show Unread In different way
Post by: t2noob on May 24, 2009, 05:54:38 PM
Ok I don't know if there is a mod for this already (didn't find one in mod section) If it is point me in the right direction.
I want the Boards/topic or font to change color when the board is unread. Or something new has been posted and the user hasn't read it already. I just dont want the "New" picture to be shown i want to change the color of the board to let the user know there is something new.
Title: Re: Show Unread In different way
Post by: JimM on May 28, 2009, 10:46:10 PM
I'm not aware of a mod that does what you are asking.  I would be glad to move this to the Mod Requests board if you want.
Title: Re: Show Unread In different way
Post by: t2noob on May 29, 2009, 12:15:13 PM
Can you please move the board for me to the right section?
Title: Re: Show Unread In different way
Post by: babjusi on May 29, 2009, 12:16:47 PM
Quote from: t2noob on May 24, 2009, 05:54:38 PM
Ok I don't know if there is a mod for this already (didn't find one in mod section) If it is point me in the right direction.
I want the Boards/topic or font to change color when the board is unread. Or something new has been posted and the user hasn't read it already. I just dont want the "New" picture to be shown i want to change the color of the board to let the user know there is something new.

Is this going to be a paid project?
Title: Re: Show Unread In different way
Post by: t2noob on May 29, 2009, 04:49:31 PM
I was hoping that someone could do it out of their goodness of their heart  ;D
Title: Re: Show Unread In different way
Post by: Eliana Tamerin on May 30, 2009, 11:46:53 AM
This wouldn't be too difficult. What version of SMF are you on?
Title: Re: Show Unread In different way
Post by: t2noob on May 31, 2009, 07:05:36 PM
1.1.9 You need any more info?
Title: Re: Show Unread In different way
Post by: Eliana Tamerin on June 01, 2009, 12:08:07 PM
No, I think this should work. I should note that you will need to manually install this modification on any theme (that you use) which possesses its own BoardIndex.template.php and MessageIndex.template.php.

Open up your BoardIndex.template.php.

Find this:
echo '</a>
</td>
<td class="windowbg2">
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
', $board['description'];


Replace with this:
echo '</a>
</td>
<td class="windowbg2">',$board['new'] ? '<span style="color: red;">' : '', '
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b>',$board['new'] ? '</span>' : '', '
  <br />', $board['description'];


If you want the Child boards to have the same effect, then find this:
$children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];

Replace with this:
$children[] = $child['new'] ? '<span style="color: red;"><b>' . $child['link'] . '</b></span>' : $child['link'];

Open up your MessageIndex.template.php.

We'll do the same thing to any child boards listed in the message index:
Find this:
echo '</a>
</td>
<td class="windowbg2">
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
', $board['description'];


Replace with this:
echo '</a>
</td>
<td class="windowbg2">',$board['new'] ? '<span style="color: red;">' : '', '
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b>',$board['new'] ? '</span>' : '', '
  <br />', $board['description'];


And maybe for their child boards, too?
$children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];

Replace with this:
$children[] = $child['new'] ? '<span style="color: red;"><b>' . $child['link'] . '</b></span>' : $child['link'];

Then we need to edit how the topics are colored:
Find this:
// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '
<a href="', $topic['new_href'], '" id="newicon' . $topic['first_post']['id'] . '"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" /></a>';


Replace with this:
// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '
<span style="color: red;"><a href="', $topic['new_href'], '" id="newicon' . $topic['first_post']['id'] . '"></span><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" /></a>';



That should do it. But I haven't tested this, so let me know if it doesn't work. Also, you can change the color to any written or numbered color you wish, just change color: red; to whatever color you want. I set it red because that shows up best against the default theme.
Title: Re: Show Unread In different way
Post by: t2noob on June 01, 2009, 06:15:41 PM
No I don't think its working...
I tested it on both my modified theme and default and nothing changes at all. It just shows up like it would regularly.
Any ideas?
Title: Re: Show Unread In different way
Post by: Eliana Tamerin on June 02, 2009, 07:06:35 AM
And this is why I need to test things. :P

Open up your BoardIndex.template.php.

Find this:
echo '</a>
</td>
<td class="windowbg2">
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
', $board['description'];


Replace with this:
echo '</a>
</td>
<td class="windowbg2">
',$board['new'] ? '<b><a href="'. $board['href']. '" style="color: red;" name="b'. $board['id']. '">' : '<b><a href="'. $board['href']. '" name="b'. $board['id']. '">',  $board['name'], '</a></b><br />
', $board['description'];


If you want the Child boards to have the same effect, then find this:
$child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] . ')">' . $child['name'] . '</a>';

Replace with this:
$child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] . ')" style="' . ($child['new'] ? 'color: red;' : '') . '">' . $child['name'] . '</a>';

Open up your MessageIndex.template.php.

We'll do the same thing to any child boards listed in the message index:
Find this:
echo '</a>
</td>
<td class="windowbg2">
<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
', $board['description'];


Replace with this:
echo '</a>
</td>
<td class="windowbg2">
',$board['new'] ? '<b><a href="'. $board['href']. '" style="color: red;" name="b'. $board['id']. '">' : '<b><a href="'. $board['href']. '" name="b'. $board['id']. '">',  $board['name'], '</a></b><br />
', $board['description'];


And maybe for the child boards, too?
$child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] . ')">' . $child['name'] . '</a>';

Replace with this:
$child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] . ')" style="' . ($child['new'] ? 'color: red;' : '') . '">' . $child['name'] . '</a>';

This is the biggest part that's changed. I didn't realize how locked up the templating is here, so unfortunately you'll have to edit your source. This means you either need to create a new variable for each theme, or keep the color the same for each theme. I'm sorry, there's no way around this.

Then we need to edit how the topics are colored:
Find this:
', $topic['is_sticky'] ? '<b>' : '' , '<span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span>', $topic['is_sticky'] ? '</b>' : '';

Replace with this:
', $topic['is_sticky'] ? '<b>' : '' , '<span id="msg_' . $topic['first_post']['id'] . '">', ($topic['new'] && $context['user']['is_logged']) ? $topic['first_post']['new_link'] : $topic['first_post']['link'], '</span>', $topic['is_sticky'] ? '</b>' : '';

Now open your ./Sources/MessageIndex.php file:
Find this:
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['firstSubject'] . '</a>'

Replace with this:
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['firstSubject'] . '</a>',
'new_link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0" style="color: red;">' . $row['firstSubject'] . '</a>'


Be mindful, there's a discreet comma (,) after the first line on that source file, it'll cause an error if you don't insert it.

You can still change the color to any written or numbered color you wish, just change color: red; to whatever color you want. I set it red because that shows up best against the default theme.

I hope that works now. I tested it, though, so it should.
Title: Re: Show Unread In different way
Post by: t2noob on June 02, 2009, 12:55:56 PM
Thanks appreciate it!!
I'm at school right now so I'll check it tonight when I get home.
Title: Re: Show Unread In different way
Post by: t2noob on June 02, 2009, 07:11:20 PM
In the source code Display.php I cant find this code
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['firstSubject'] . '</a>'
Can you tell me what line its on?
I found a similar code
'link' => '<a href="' . $scripturl . '?topic=' . $topic . '.msg' . $message['ID_MSG'] . '#msg' . $message['ID_MSG'] . '">' . $message['subject'] . '</a>',
And replaced it with the one you gave me
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['firstSubject'] . '</a>',
'new_link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0" style="color: red;">' . $row['firstSubject'] . '</a>',

When I replaced it with the one you gave me the board code worked because it changed the color to red.
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Frftribes.com%2Fdownloads%2FFont_works.jpg&hash=29c8f93dcac76a16c76ddad58862a17718d8a9b9)


but when I clicked on it to see the topic I couldn't see the name of the actual topic all I saw was the "new" picture. LIke this
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Frftribes.com%2Fdownloads%2Ftopic_gone.jpg&hash=c103b5934a826daec294d64e3989f61150c52a4a)

It must be something small with the code because once I read the topic by clicking on the "new" Picture I can then see the name of the topic.
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Frftribes.com%2Fdownloads%2FAfter_I%2520read.jpg&hash=cc1717a34c3a0478f90370e33da8eb8bd86536a6)

Any Ideas on how to fix it?
Title: Re: Show Unread In different way
Post by: Eliana Tamerin on June 02, 2009, 11:39:05 PM
Sorry, I meant look in your MessageIndex.php in your sources folder. I wasn't thinking straight.
Title: Re: Show Unread In different way
Post by: t2noob on June 03, 2009, 11:42:28 AM
awesome it worked!
Thank you very much appreciate it
Title: Re: Show Unread In different way
Post by: Eliana Tamerin on June 03, 2009, 12:34:41 PM
Just make sure you reset that line in Display.php, otherwise that's going to be messed up.
Title: Re: Show Unread In different way
Post by: t2noob on June 03, 2009, 07:32:31 PM
Yes I Just put the Back up I had Thanks for the help.
Title: Re: Show Unread In different way
Post by: TurtleKicker on September 07, 2009, 11:10:01 AM
This is exactly what I'm looking for... don't suppose anyone is up for packaging this up properly as an actual mod? Since the changes have been worked out. ;)

I'm on SMF 1.1.10
Title: Re: Show Unread In different way
Post by: tyty1234 on October 15, 2009, 01:03:30 PM
This has been packaged into a mod.
Highlight Unread Topics (http://custom.simplemachines.org/mods/index.php?mod=2146)