Log in

View Full Version : Thread Sorting


MarkB
04-04-2002, 08:39 AM
Hi,

Is it possible to hack forumdisplay so it will sort threads based solely on their first post date?

Also, is there a '10 recent posts' hack that displays them, again, based on the date they were started not by the date of their last post?

Thx :)
Mark

Admin
04-04-2002, 10:15 AM
In forumdisplay.php replace:
$sortfield='lastpost';
}
if ($sortfield=="voteavg" and !$foruminfo[allowratings]) {
$sortfield="lastpost";
}
with:
$sortfield = 'dateline';
}
if ($sortfield == 'voteavg' and !$foruminfo['allowratings']) {
$sortfield = 'dateline';
}

MarkB
04-04-2002, 10:28 AM
Thanks Chen, is there a way to do it in only certain forums?

Admin
04-04-2002, 10:31 AM
I saw that coming. ;)
https://vborg.vbsupport.ru/showthread.php?s=&threadid=34556

MarkB
04-04-2002, 11:34 AM
LOL I actually posted in that thread :o Talk about a bad memory... :) Thanks! :)

MarkB
04-04-2002, 10:30 PM
Ok, I installed that other hack, but it doesn't work for me. I'm setting the sort field to 'dateline', as I figured that was the required field based on your code above, but it sorts them as per normal...

Does 'dateline' reflect the original posting date, or does it change whenever someone posts to the thread?

Admin
04-05-2002, 05:22 AM
dateline, in most vB tables, means "when the record was created". In this example, "when the thread was created". lastpost updates every time.

MarkB
04-05-2002, 06:43 AM
Hmm... so basically, if I set dateline to be the sort field, it should list them by start date - which obviously isn't working in this case? :(

Admin
04-05-2002, 06:47 AM
Ok, in forumdisplay.php replace:
case 'postusername':
case 'voteavg':
with:
case 'postusername':
case 'voteavg':
case 'dateline':

MarkB
04-05-2002, 06:56 AM
Champion :) Cheers guv!

noonespecial
04-06-2004, 02:37 AM
Champion :) Cheers guv!
can this be done in vb?

MickDoneDee
12-07-2004, 10:28 PM
I'd like to add a sort option to the dropdown menu at the bottom of forumdisplay in Display Options. I'd like to sort by Thread Start Date which is an option available in search.php but not forumdisplay.php. I've tried myself but haven't come up with the correct query. Does anybody know what code for forumdisplay.php and forumdisplay template would generate the right query? It needs to be able to sort sticky threads as well. Using the code from search.php doesn't seem to work.