Advertisement:

Author Topic: Highlight thread w/different color when it contains a user's own post  (Read 24026 times)

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Hello everybody... I'm (obviously) new to this board and I've been using SMF on my site for slightly less than three months now.

I would like to implement a feature I've seen on many forums on the Net: since I hardly notice the "bubble" icon on the left which is shown on threads in which a user has posted, I'd prefer instead to highlight the thread using a different background color for the row...

I understand that I have to modify SMF sources, but I'd be more than grateful if somebody could help me to do so: pointing at the right file to study/change (I'm just a C programmer, but I think I can at least try to look at PHP sources  :D) would be an excellent thing to start with!  :)

Thanks for your attention and excuse me for my English. Feel free to ask me everything that's not clear.

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Highlight thread w/different color when it contains a user's own post
« Reply #1 on: September 27, 2005, 03:53:27 PM »
I'd look into Display.template.php in the theme dir. That's a good start. ;)
Cristián Lávaque http://cristianlavaque.com

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Highlight thread w/different color when it contains a user's own post
« Reply #2 on: September 28, 2005, 05:23:10 AM »
Thanks! I'll have a look at it NOW!  :D

Offline Anguz

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,430
  • Gender: Male
    • cristianlavaque.com
Re: Highlight thread w/different color when it contains a user's own post
« Reply #3 on: September 28, 2005, 11:39:17 AM »
I'm gonna double check if I got your question right, cause now I'm not sure. You want that when a person is reading a topic, the posts made by him are marked in a certain way, right?
Cristián Lávaque http://cristianlavaque.com

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Highlight thread w/different color when it contains a user's own post
« Reply #4 on: September 29, 2005, 09:09:39 AM »
Hmmm well, I want a slightly different thing  :)

Let's write it down just to be on the safe side:


Suppose this is the index of a (sub) forum:

ICON 1 --- ICON 2 --- THREAD TITLE 1 ----------------- REPLIES ----- VIEWS -------
ICON 1 --- ICON 2 --- THREAD TITLE 2 ----------------- REPLIES ----- VIEWS -------
ICON 1 --- ICON 2 --- THREAD TITLE 3 ----------------- REPLIES ----- VIEWS -------

with the default (classic) theme, ICON 1 is something like a comic bubble when a user is logged AND it has posted in that thread...

what I'd like to implement in this case, is to change the entire background color of the ROW (for example: turning it a bit darker) for the user to visually/instantly see what were the topics where he actually posted.

I hope it is explained better now  :)

Offline Elissen

  • Full Member
  • ***
  • Posts: 466
  • Gender: Male
    • ICSC
Re: Highlight thread w/different color when it contains a user's own post
« Reply #5 on: September 29, 2005, 10:11:41 AM »
I did this with the default template in a 1.1

Edit MessageIndex.template.php, look for a line
Code: [Select]
foreach ($context['topics'] as $topic)In 1.1 it's around like 160. All edit are below this.

Search:
Code: [Select]
                                <tr class="windowbg2">replace
Code: [Select]
                                <tr class="', ($topic['is_posted_in'] ? 'row_posted' : 'windowbg2'), '">
Search:
Code: [Select]
                                        <td class="windowbg" valign="middle">replace
Code: [Select]
                                        <td class="', ($topic['is_posted_in'] ? 'row_posted' : 'windowbg'), '" valign="middle">
Search (twice)
Code: [Select]
                                        <td class="windowbg" valign="middle" width="4%" align="center">Replace (twice)
Code: [Select]
                                        <td class="', ($topic['is_posted_in'] ? 'row_posted' : 'windowbg'), '" valign="middle" width="4%" align="center">
In 1.1 classic it's pretty much the same. Look for the loop and replace all windowbg(2) in the td-tags by ', ($topic... ), '

And add a class "row_posted" to your stylesheet (copy from windowbg and change the color)

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Highlight thread w/different color when it contains a user's own post
« Reply #6 on: September 30, 2005, 04:13:41 AM »
Thank you VERY much Elissen!  :D

I will try it on a test board and will let you know if everything went right!

I haven't switched (yet) to SMF 1.1 -still stuck at 1.0.5- but I don't think... well... I *HOPE* this won't be a problem.

Thanks again!!!!  ;D


Offline Elissen

  • Full Member
  • ***
  • Posts: 466
  • Gender: Male
    • ICSC
Re: Highlight thread w/different color when it contains a user's own post
« Reply #7 on: September 30, 2005, 04:53:25 AM »
In 1.0.5 you need to replace all
Code: [Select]
<td class="windowbg"to
Code: [Select]
<td class="', ($topic['is_posted_in'] ? 'row_posted' : 'windowbg'), '"
and

Code: [Select]
<td class="windowbg2"to
Code: [Select]
<td class="', ($topic['is_posted_in'] ? 'row_posted' : 'windowbg2'), '"
between lines 160 and 201 in MessageIndex.template.php

Offline Turrican3

  • Semi-Newbie
  • *
  • Posts: 58
Re: Highlight thread w/different color when it contains a user's own post
« Reply #8 on: September 30, 2005, 07:06:01 AM »
It works!  :D

Now I'm studying a nice color combination because my forum currently uses a different (not the default one I mean) theme...  ;)

THANKS again!!!!




Offline Elissen

  • Full Member
  • ***
  • Posts: 466
  • Gender: Male
    • ICSC
Re: Highlight thread w/different color when it contains a user's own post
« Reply #9 on: September 30, 2005, 07:50:15 AM »
nice to hear, and no problem at all

Offline nitins60

  • Sr. Member
  • ****
  • Posts: 838
  • Gender: Male
  • LoVE mAKeS lIFe bEauTIfUL
    • Simple Mobile Forum - SMF
Re: Highlight thread w/different color when it contains a user's own post
« Reply #10 on: December 29, 2006, 11:16:38 PM »
Didn't find above lines n 1.1.1

Offline nitins60

  • Sr. Member
  • ****
  • Posts: 838
  • Gender: Male
  • LoVE mAKeS lIFe bEauTIfUL
    • Simple Mobile Forum - SMF
Re: Highlight thread w/different color when it contains a user's own post
« Reply #11 on: January 03, 2007, 10:14:27 AM »
Bump

Offline IchBin™

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,115
  • Gender: Male
  • I don't speak German.
    • IchBin.us
Re: Highlight thread w/different color when it contains a user's own post
« Reply #12 on: February 03, 2007, 07:10:39 PM »
Just look a bit further down nitins60. More like lines 187 - 247.
Brad "IchBin™" Grow        TinyPortal        Themes
Coding Guidelines