News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Tip for SMF 2.0: Add 'Start Date' to Message Index Sorting

Started by GL700Wing, September 09, 2023, 08:51:53 PM

Previous topic - Next topic

GL700Wing

In response to this request to Order topics by started date

In ./Sources/MessageIndex.php
Find:
if (isset($_REQUEST['sort']) && !in_array($_REQUEST['sort'], array('subject', 'starter', 'last_poster', 'replies', 'views', 'first_post', 'last_post')))Replace With:
if (isset($_REQUEST['sort']) && !in_array($_REQUEST['sort'], array('subject', 'starter', 'date', 'last_poster', 'replies', 'views', 'first_post', 'last_post')))
Find:
        'starter' => 'IFNULL(memf.real_name, mf.poster_name)',Add After:
        'date' => 'first_poster_time',
In ./Themes/default/MessageIndex.template.php
Find:
<th scope="col" class="lefttext"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=starter', $context['sort_by'] == 'starter' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['started_by'], $context['sort_by'] == 'starter' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>Replace With:
<th scope="col" class="lefttext"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=starter', $context['sort_by'] == 'starter' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['started_by'], $context['sort_by'] == 'starter' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=date', $context['sort_by'] == 'date' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['topic_start_date'], $context['sort_by'] == 'date' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
Find:
<p>', $txt['started_by'], ' ', $topic['first_post']['member']['link'], 'Replace With:
<p>', $txt['started_by'], ' ', $topic['first_post']['member']['link'], ' ', $txt['on'], ' ', $topic['first_post']['time'], '
In ./Themes/default/languages/index.english.php
Add to end of file:
$txt['topic_start_date'] = 'Date Started';

You cannot view this attachment.


Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Steve

DO NOT pm me for support!

GL700Wing

Quote from: Steve on September 10, 2023, 06:34:44 AMDoes this work with 2.1.4 also?
Don't know - I'll check tomorrow and let you know ...
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

FragaCampos

Thanks a lot for doing this after my request, GL700Wing.
I did your suggested edits, but I get a blank page afterwards. Maybe it's a conflict with some other mod.

If I attach here my affected files, could you be so kind to take a look at them?

Steve

DO NOT pm me for support!

FragaCampos

Oh, I didn't realize there was a mod.  O:)

Thank you, @Steve.

Steve

DO NOT pm me for support!

Advertisement: