Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Turrican3 on September 27, 2005, 11:06:56 AM

Title: Highlight thread w/different color when it contains a user's own post
Post by: Turrican3 on September 27, 2005, 11:06:56 AM
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.
Title: Re: Highlight thread w/different color when it contains a user's own post
Post by: Anguz on September 27, 2005, 03:53:27 PM
I'd look into Display.template.php in the theme dir. That's a good start. ;)
Title: Re: Highlight thread w/different color when it contains a user's own post
Post by: Turrican3 on September 28, 2005, 05:23:10 AM
Thanks! I'll have a look at it NOW!  :D
Title: Re: Highlight thread w/different color when it contains a user's own post
Post by: Anguz 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?
Title: Re: Highlight thread w/different color when it contains a user's own post
Post by: Turrican3 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  :)
Title: Re: Highlight thread w/different color when it contains a user's own post
Post by: Elissen 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
foreach ($context['topics'] as $topic)
In 1.1 it's around like 160. All edit are below this.

Search:
                                <tr class="windowbg2">
replace
                                <tr class="', ($topic['is_posted_in'] ? 'row_posted' : 'windowbg2'), '">

Search:
                                        <td class="windowbg" valign="middle">
replace
                                        <td class="', ($topic['is_posted_in'] ? 'row_posted' : 'windowbg'), '" valign="middle">

Search (twice)
                                        <td class="windowbg" valign="middle" width="4%" align="center">
Replace (twice)
                                        <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)
Title: Re: Highlight thread w/different color when it contains a user's own post
Post by: Turrican3 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

Title: Re: Highlight thread w/different color when it contains a user's own post
Post by: Elissen on September 30, 2005, 04:53:25 AM
In 1.0.5 you need to replace all
<td class="windowbg"
to
<td class="', ($topic['is_posted_in'] ? 'row_posted' : 'windowbg'), '"

and

<td class="windowbg2"
to
<td class="', ($topic['is_posted_in'] ? 'row_posted' : 'windowbg2'), '"

between lines 160 and 201 in MessageIndex.template.php
Title: Re: Highlight thread w/different color when it contains a user's own post
Post by: Turrican3 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!!!!



Title: Re: Highlight thread w/different color when it contains a user's own post
Post by: Elissen on September 30, 2005, 07:50:15 AM
nice to hear, and no problem at all
Title: Re: Highlight thread w/different color when it contains a user's own post
Post by: nitins60 on December 29, 2006, 11:16:38 PM
Didn't find above lines n 1.1.1
Title: Re: Highlight thread w/different color when it contains a user's own post
Post by: nitins60 on January 03, 2007, 10:14:27 AM
Bump
Title: Re: Highlight thread w/different color when it contains a user's own post
Post by: IchBin™ on February 03, 2007, 07:10:39 PM
Just look a bit further down nitins60. More like lines 187 - 247.