News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Highlight thread w/different color when it contains a user's own post

Started by Turrican3, September 27, 2005, 11:06:56 AM

Previous topic - Next topic

Turrican3

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.

Anguz

I'd look into Display.template.php in the theme dir. That's a good start. ;)
Cristián Lávaque http://cristianlavaque.com


Anguz

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

Turrican3

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  :)

Elissen

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)

Turrican3

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


Elissen

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

Turrican3

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!!!!




Elissen


nitins60



IchBin™

Just look a bit further down nitins60. More like lines 187 - 247.
IchBin™        TinyPortal

Advertisement: