Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: jack_1985 on December 28, 2015, 02:37:22 PM

Title: Have the same Message Icon for replies as that of the starting post
Post by: jack_1985 on December 28, 2015, 02:37:22 PM
Hi everyone!

I have a bit of a dilemma and I would be very happy if someone would be willing shed some light on this subject. For SMF 2.0.11.

When someone posts a new topic they have the option to select a message icon from a dropdown menu. (For example, I have now chosen the question mark icon).
However, every time someone posts a reply, they have to select the icon all over again. The icon chosen by the OP for the thread isn't automatically selected for replies.

I find this a bit strange, so I would like to make the modification that the message icon from the starting post is automatically selected when you are replying.
(Alternatively, not being able to change it at all and just use the same icon automatically for replies would also be fine).

Could someone please tell me how I would achieve this adjustment or point me in the right direction?  Thank you very much for your support! :)
Title: Re: Have the same Message Icon for replies as that of the starting post
Post by: margarett on December 28, 2015, 06:13:27 PM
In concept it's more or less easy ;)

Sources/Post.php, find:
CASE WHEN ml.poster_time > ml.modified_time THEN ml.poster_time ELSE ml.modified_time END AS last_post_time
Replace with:
CASE WHEN ml.poster_time > ml.modified_time THEN ml.poster_time ELSE ml.modified_time END AS last_post_time, mf.icon

Find:
list ($locked, $context['notify'], $sticky, $pollID, $context['topic_last_message'], $id_member_poster, $id_first_msg, $first_subject, $lastPostTime) = $smcFunc['db_fetch_row']($request);
Replace with:
list ($locked, $context['notify'], $sticky, $pollID, $context['topic_last_message'], $id_member_poster, $id_first_msg, $first_subject, $lastPostTime, $first_icon) = $smcFunc['db_fetch_row']($request);

Find:
// By default....
$context['use_smileys'] = true;
$context['icon'] = 'xx';

Replace with:
// By default....
$context['use_smileys'] = true;
$context['icon'] = !empty($first_icon) ? $first_icon : 'xx';


That works for the full reply. Quick reply needs other kind of "love"
Title: Re: Have the same Message Icon for replies as that of the starting post
Post by: jack_1985 on December 29, 2015, 03:46:31 AM
That solution works perfectly for the full reply! Thanks a lot! :)