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.
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.
Can you please move the board for me to the right section?
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?
I was hoping that someone could do it out of their goodness of their heart ;D
This wouldn't be too difficult. What version of SMF are you on?
1.1.9 You need any more info?
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.
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?
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.
Thanks appreciate it!!
I'm at school right now so I'll check it tonight when I get home.
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?
Sorry, I meant look in your MessageIndex.php in your sources folder. I wasn't thinking straight.
awesome it worked!
Thank you very much appreciate it
Just make sure you reset that line in Display.php, otherwise that's going to be messed up.
Yes I Just put the Back up I had Thanks for the help.
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
This has been packaged into a mod.
Highlight Unread Topics (http://custom.simplemachines.org/mods/index.php?mod=2146)