View Full Version : sort on start thread date, how ( is use thread start time.txt hack)
thenight
08-26-2002, 06:24 PM
Hey,
I installed a hack* to add the date/time to the thread starter but now I want to sort on that date and not on the username.
Any ideas how, have been playing arround with forumdisplay_threadslist and replaced postusername with threadstart. because that name was introduced with the hack see below :
$thread[threadstartdate]=vbdate($dateformat,$thread[threadstart]);
$thread[threadstarttime]=vbdate($timeformat,$thread[threadstart]);
The Night @ The Night scans & caps (http://www.thenightscans.com/)
*=thread start time.txt
thenight
08-26-2002, 07:03 PM
in forumdisplay.php
$threads=$DB_site->query("
SELECT $dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid,
lastposter,thread.dateline AS threadstart,views,thread.iconid,notes,thread.visib le,sticky,votetotal,attach
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
$dotjoin
WHERE $threadids
ORDER BY sticky DESC, $sortfield $sqlsortorder
I changed $sortfield to threadstart and then it worked. But that is quick and dirty was is the neat way. And Do I need to edit forumdisplay_threadslist because its using postusername now ??
The Night
Issvar
08-26-2002, 11:29 PM
The neat way would be to find
switch ($sortfield) {
and you see a bunch of cases, add your custom sortfield(s) to that, and then comes a default, set the field you want to be default as default there. Three lines down you see again $sortfield="lastpost"; replace lastpost in that line as well, and you're done.
Users will still be able to sort on other things if they want to, but the standard sorting is changed to what you want.
edit: that would be in file forumdisplay.php
thenight
08-27-2002, 04:43 PM
then I get a ambious error on dateline
====
$getthreadids=$DB_site->query("
SELECT
".iif($sortfield=="voteavg",$votequery,"")."
thread.threadid
FROM thread
WHERE thread.forumid = $foruminfo[forumid]
AND thread.sticky=0
AND thread.visible=1
$datecut
$limitothers
ORDER BY sticky DESC, $sortfield $sqlsortorder
LIMIT ".($sel_limitlower-1).",$perpage");
$threadids='thread.threadid IN (0';
while ($thread=$DB_site->fetch_array($getthreadids)) {
$threadids .= "," . $thread['threadid'];
}
if ($stickyids != '') {
$threadids .= $stickyids;
}
$threadids.=')';
$threads=$DB_site->query("
SELECT $dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid,
lastposter,thread.dateline AS threadstart,views,thread.iconid,notes,thread.visib le,sticky,votetotal,attach
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
$dotjoin
WHERE $threadids
ORDER BY sticky DESC, threadstart $sqlsortorder
");
======
Weird thing is that I can't change $sortfield to
threadstart because then I get another type of sql error, table not know.
I got it working now with the way above, and removed all sorting options from the templates.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.