Anyone know if you can add an option like "sort threads by date thread started" into the drop-down list at the bottom of a page?
Mentor
07-17-2001, 04:14 PM
Ill make this for you. But how about a link on top next to the other "sort by" links?
Mentor
07-17-2001, 04:53 PM
Make a copy of newthread.php and forumdisplay.php now!!!
Then open newthread.php On line 209 replace
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,iconid, visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($subject))."','".time()."','$forumid','1','0','".addslashes($postusername)."','$bbuserinfo[userid]','".addslashes($postusername)."','".time()."','$iconid','$visible','$attachcount')");
with
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,iconid, visible,attach,datestarted) VALUES (NULL,'".addslashes(htmlspecialchars($subject))."','".time()."','$forumid','1','0','".addslashes($postusername)."','$bbuserinfo[userid]','".addslashes($postusername)."','".time()."','$iconid','$visible','$attachcount','".time()."')");
Save and close. Then, Execute the folowing command on your vbulletin mysql database.
ALTER TABLE thread ADD datestarted VARCHAR (50) not null
Open forumdisplay.php and around like 308 find
switch ($sortfield) {
case 'title':
case 'lastpost':
case 'replycount':
case 'views':
case 'postusername':
case 'voteavg':
and change that to
switch ($sortfield) {
case 'datestarted':
case 'title':
case 'lastpost':
case 'replycount':
case 'views':
case 'postusername':
case 'voteavg':
Then, around line 401 find
lastposter,thread.dateline,views,thread.iconid,not es,thread.visible,sticky,votetotal,attach
And replace with
lastposter,thread.dateline,views,thread.iconid,not es,thread.visible,sticky,votetotal,attach,datestar ted
Save that.
Now, login to your admin and change the folowing templete
forumdisplay_threadslist
Find
<select name="sortfield">
<option value="title" $sort[title]>thread title</option>
and right under that add
<option value="datestarted" $sort[datestarted]>date started</option>
Well, that should do it!... I tested it and it works...dont know how it will effect posts b4 this hack was installed.. :(
Mentor
07-17-2001, 04:55 PM
Haha...something is wrong with my trailing PHP tag :( its there, just dont want to work!
Why not just use thread.dateline? What's the reason for adding the additional field?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.