TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,856
  • Total Topics: 21,292
  • Online today: 713
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 415
  • Total: 415

Recent Block - Member Color

Started by Kimmen, February 04, 2011, 11:27:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Kimmen

Link to my site: http://www.efclan.eu
SMF version: SMF2 RC4
TP version: TinyPortal 1.0 RC1
Default Forum Language: English
Theme name and version: Catamosphere by Shine-Art & Smf Personal
Browser Name and Version: Firefox
Mods installed: Aeva Media 1.4c - MCLegendII RC3 3.0 - Member Color Link 3.0.8 - Curve_centered_menu 1.2 - Menu_Icons 1.0 - Custom Buttons / tabs and menus
Related Error messages: Error message here

How can i easy make the recent topics block display the set membergroup color on the users? Right now, it display only a default color, i want that it display the current membergroup color instead.

IchBin

TP uses the ssi_recentTopics() function from SMF to get the latest topics. That function does not call the user member group color. You'll have to modify the SSI.php file to get this to work properly.

In SSI.php recentTopics function:
Find this line:
m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,

Replace with:
m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, grp.online_color, b.id_board, b.name AS board_name, t.num_replies, t.num_views,

Find:
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' : '') . '

Add After:
LEFT JOIN {db_prefix}membergroups AS grp ON (mem.id_group = grp.id_group)


Find:
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'

Replace with:
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '"><span style="color: '. $row['online_color'] .'">' . $row['poster_name'] . '<span></a>'

Kimmen

Almost, the color is showing, have a look at my site: www.efclan.eu it displayes like this:

# Upcoming staff meeting Su... by
MylilPwny">MylilPwny
[Today at 20:03:27]

I guess its not supposed to show my name twice or?  ;D

IchBin

I don't see a mistake in my code that I posted. Could you post the contents in that function that you modified so I can see if you made a mistake?

Kimmen

1:
// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, grp.online_color, b.id_board, b.name AS board_name, t.num_replies, t.num_views,


2:
// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, grp.online_color, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_modified AS is_read,
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ', SUBSTRING(m.body, 1, 384) AS body, m.smileys_enabled, m.icon
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (!$user_info['is_guest'] ? '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' : '') . '
                        LEFT JOIN {db_prefix}membergroups AS grp ON (mem.id_group = grp.id_group)


3:
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '"><span style="color: '. $row['online_color'] .'">' . $row['poster_name'] . '<span></a>' . '">' . $row['poster_name'] . '</a>'


There is what i have, here you also can see my SSI.php



IchBin

You see the mistake you made in the very last code section? :)

This: 'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '"><span style="color: '. $row['online_color'] .'">' . $row['poster_name'] . '<span></a>' . '">' . $row['poster_name'] . '</a>'


Should be this:
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '"><span style="color: '. $row['online_color'] .'">' . $row['poster_name'] . '<span></a>'

Kimmen

I have again changed the code, i dont see any changes in Firefox, but IE shows like this now:

ââ,¬Â¢Paris, New York and Tehra... by
MylilPwny">MylilPwny
[February 04, 2011, 14:30:12]


Could you be so sweet and edit my SSI.php please? This is crazy  :-[

IchBin


Kimmen

Yeah, that fix the problem of name appearing twice, but i notice something else. The structure of the listing, i would imagen it was supposed to list this way:

Topic name
By User
Date - Year - Time


Example:
What We Know So Far (Rele...
by MylilPwny
[Today at 13:42:54]

But it seems to depend on the length of topic name, so short topicnames, it would display like this:

Server Ping by MylilPwny
[February 05, 2011, 12:52:08]

How can we make it display on three lines like described above?

IchBin

So you won't care if someone has a long topic and then it makes your shoutbox have a scroll bar for left to right? It limits the topic title length for that very reason.

This website is proudly hosted on Crocweb Cloud Website Hosting.