Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Melonking on February 01, 2022, 06:40:39 PM

Title: Clickable last post date?
Post by: Melonking on February 01, 2022, 06:40:39 PM
Hi, not sure if this is just a setting or a mod or something that needs to be custom coded. On this forum when you are on a board you can click the last post date and it will take you to the last post of a topic. On my forum running 2.0.18 you cannot do that. Is there a way I can add this feature?
Title: Re: Clickable last post date?
Post by: Sir Osis of Liver on February 01, 2022, 07:04:46 PM
In 2.0 you get to last post by clicking on "in topic title" in right column.  Date/time is not linked.
Title: Re: Clickable last post date?
Post by: Arantor on February 01, 2022, 07:59:21 PM
And when you're inside a board, on 2.1 (like this site) you can use the title to get to the last post; on 2.0 you have to click the little arrow that's present:

last_post.PNG
Title: Re: Clickable last post date?
Post by: Melonking on February 02, 2022, 08:01:08 AM
Quote from: Arantor on February 01, 2022, 07:59:21 PMAnd when you're inside a board, on 2.1 (like this site) you can use the title to get to the last post; on 2.0 you have to click the little arrow that's present:

last_post.PNG

Interesting, this is completely missing from my forum theme, do you have a code snippet to for this?
Title: Re: Clickable last post date?
Post by: Arantor on February 02, 2022, 08:52:11 AM
Before I get into that, I want to clear one thing up. Sir Osis figured you were on the list of boards (the front page), while I figured you were on the list of topics inside a board?

Which is it, because it affects which file to go looking in...?
Title: Re: Clickable last post date?
Post by: Melonking on February 02, 2022, 09:08:24 AM
Quote from: Arantor on February 02, 2022, 08:52:11 AMBefore I get into that, I want to clear one thing up. Sir Osis figured you were on the list of boards (the front page), while I figured you were on the list of topics inside a board?

Which is it, because it affects which file to go looking in...?

You figured correctly, topic list is what I was trying to describe! The topic link shows as expected on the list of boards.
Title: Re: Clickable last post date?
Post by: Sir Osis of Liver on February 02, 2022, 11:31:51 AM
The button is last_post.gif in MessageIndex.template.php -


<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>
<td class="lastpost ', $alternate_class, '">
<a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" /></a>
', $topic['last_post']['time'], '<br />
', $txt['by'], ' ', $topic['last_post']['member']['link'], '
</td>';


It doesn't appear in some themes, and in others is removed only in mobile display.  I've added it back in, it's annoying not to have it.
Title: Re: Clickable last post date?
Post by: Melonking on February 02, 2022, 03:47:31 PM
Thanks! I was able to merge this into the last post date, code added below for anyone interested.

<td class="windowbg2" valign="middle" width="22%">
            <span class="smalltext">',
                '<a href="',
                $topic['last_post']['href'],
                '">',
                $topic['last_post']['time'],
                '</a>',
                '<br />',
                $txt['by'],
                ' ',
                $topic['last_post']['member']['link'],
                '</span></td>';
Title: Re: Clickable last post date?
Post by: Doug Heffernan on February 02, 2022, 04:47:36 PM
Quote from: Melonking on February 02, 2022, 03:47:31 PMThanks! I was able to merge this into the last post date, code added below for anyone interested.

<td class="windowbg2" valign="middle" width="22%">
            <span class="smalltext">',
                '<a href="',
                $topic['last_post']['href'],
                '">',
                $topic['last_post']['time'],
                '</a>',
                '<br />',
                $txt['by'],
                ' ',
                $topic['last_post']['member']['link'],
                '</span></td>';


Thanks for posting the solution. It will come in handy to others who might want to achieve the same thing.