Customizing SMF > SMF Coding Discussion

Help me write this code...

(1/8) > >>

Liam_michael:
In messageindex... I want the following argument:

If the person who started the topic is in group 15 or 21, show the topic title in red.

I have narrowed down where I am supposed to make the changes in MessageIndex.php.


--- Code: ---// 'Print' the topic info.
$context['topics'][$row['ID_TOPIC']] = array(
'id' => $row['ID_TOPIC'],
'first_post' => array(
'id' => $row['ID_FIRST_MSG'],
'member' => array(
'membergroup' => $context['redbold']['member'][$row['firstID_MEMBER']]['membergroup'],
'username' => $row['firstMemberName'],
'name' => $row['firstDisplayName'],
'id' => $row['firstID_MEMBER'],
'href' => !empty($row['firstID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row['firstID_MEMBER'] : '',
'link' => !empty($row['firstID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['firstID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['firstDisplayName'] . '">' . $row['firstDisplayName'] . '</a>' : (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$row['firstDisplayName'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '')
),
'time' => timeformat($row['firstPosterTime']),
'timestamp' => forum_time(true, $row['firstPosterTime']),
'subject' => $row['firstSubject'],
'preview' => $row['firstBody'],
'icon' => $row['firstIcon'],
'icon_url' => $settings[$context['icon_sources'][$row['firstIcon']]] . '/post/' . $row['firstIcon'] . '.gif',
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0"'  . $row['nice_tooltip_first_msg'] . '>' . $row['firstSubject'] . '</a>'
--- End code ---

Specifically where it says: 'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0"'  . $row['nice_tooltip_first_msg'] . '>' . $row['firstSubject'] . '</a>'

This is for 1.x

Liam_michael:
Help!

DanCarroll:
Liam, I am not familiar with that section of code but if I was really wanting to change the style myself given a certain condition I might look at jQuery or inline styles. Can you identify which ones you want to change? How about adding an inline <span style="color:red;">?


Liam_michael:

--- Quote from: DanCarroll on March 11, 2012, 04:45:07 PM ---Liam, I am not familiar with that section of code but if I was really wanting to change the style myself given a certain condition I might look at jQuery or inline styles. Can you identify which ones you want to change? How about adding an inline <span style="color:red;">?

--- End quote ---

I want it to be red when a person of a particular membergroup posts the topic. For instance, all topics started by users of membergroup 5 will have red topics.

DanCarroll:
Okay, without developing the code for you, let's see what you have. You say you have the code to be modified narrowed down to the 'link' line of code? Do you have the logic set up to filter by the groups you need? If so, you can set a style class up in the anchor tag and then set the color in your style sheet. Or if you don't mind inline styles, just set the color style in your anchor tag.

Hopefully all of this makes sense to you. I don't know what your level of proficiency or understanding is but this is a problem that will require some php, html, and css to synthesize a solution.

Navigation

[0] Message Index

[#] Next page

Go to full version