News:

Wondering if this will always be free?  See why free is better.

Main Menu

Sort messages by date not working

Started by mafro, November 15, 2004, 04:28:10 PM

Previous topic - Next topic

mafro

Hi all,

On my smf board (RC1) the sorting by date of messages on a boards index isnt quite working..  All is fine except for one message at the top which appears to be older...

Any ideas why this might happen?

Thanks in advance
mafro


[Unknown]

They are sorted by ID, and the ID is generated in an always-incrementing fashion upon posting.  Thus, they are sorted by posting.

If you've generated any topics or posts, you'll need to make sure they are being assigned IDs properly.

-[Unknown]

mafro

Ok, thanks - shouldve noticed sooner.

Im fairly well seasoned with smf now - any pointers where would be best the change the SQL used to draw up the list?  I need them to be ordered by posterTime..

Thanks again
mafro

[Unknown]

Sources/MessageIndex.php, find:
'last_post' => 't.ID_LAST_MSG'

Replace:
'last_post' => 'ml.posterTime'

Find:
$_REQUEST['sort'] = 't.ID_LAST_MSG';

Replace:
$_REQUEST['sort'] = 'ml.posterTime';

Find:
'first_post' => 't.ID_TOPIC',

Replace:
'first_post' => 'mf.posterTime',

In Sources/Display.php, find this twice:
ORDER BY ID_MSG

Both times, replace with:
ORDER BY posterTime

Please note that this may make your forum slower, and will not apply *everywhere*, as there are a few other places that still sort by ID.

-[Unknown]

mafro

Thanks [Unknown], youre star mate.

How did the theme contest turn out?

Mafro

Advertisement: