News:

Wondering if this will always be free?  See why free is better.

Main Menu

Show Unread In different way

Started by t2noob, May 24, 2009, 05:54:38 PM

Previous topic - Next topic

t2noob

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.

JimM

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.
Jim "JimM" Moore
Former Support Specialist

t2noob

Can you please move the board for me to the right section?

babjusi

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?

t2noob

I was hoping that someone could do it out of their goodness of their heart  ;D

Eliana Tamerin

This wouldn't be too difficult. What version of SMF are you on?
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

t2noob


Eliana Tamerin

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 colorred; to whatever color you want. I set it red because that shows up best against the default theme.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

t2noob

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?

Eliana Tamerin

#9
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 colorred; 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.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

t2noob

Thanks appreciate it!!
I'm at school right now so I'll check it tonight when I get home.

t2noob

#11
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.



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


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.


Any Ideas on how to fix it?

Eliana Tamerin

Sorry, I meant look in your MessageIndex.php in your sources folder. I wasn't thinking straight.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

t2noob

awesome it worked!
Thank you very much appreciate it

Eliana Tamerin

Just make sure you reset that line in Display.php, otherwise that's going to be messed up.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

t2noob

Yes I Just put the Back up I had Thanks for the help.

TurtleKicker

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

tyty1234

My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

Advertisement: