PDA

View Full Version : Sort forum by thread date


tgmorris
01-26-2005, 10:00 PM
A few people have been asking for a way to sort forums by the date the thread was originally posted. Here's a quick change to allow the capability to sort the threads in a forum in either ascending or descending date order.

I've tested this against 3.0.3 but it should work fine using 3.0.6.

In forumdisplay.php find the following and insert the highlighted line.
switch ($sortfield)
{
case 'title':
$sqlsortfield = 'thread.title';
break;
case 'lastpost':
case 'replycount':
case 'views':
case 'postusername':
case 'dateline':
$sqlsortfield = $sortfield;
break;
case 'voteavg':
if ($foruminfo['allowratings'])
{
$sqlsortfield = 'voteavg';
break;
} // else, use last post
default:
$sqlsortfield = 'lastpost';
$sortfield = 'lastpost';
}

In the FORUMDISPLAY template find the following and add the highlighted portion. Be sure to add the " / " on the line above newly added line.
<td class="thead" width="100%">
<if condition="$show['threadratings']"><span style="float:$stylevar[right]"><a href="$sorturl&amp;order=desc&amp;sort=voteavg">$vbphrase[rating]</a> $sortarrow[voteavg]</span></if>
<a href="$sorturl&amp;order=asc&amp;sort=title">$vbphrase[thread]</a> $sortarrow[title] /
<a href="$sorturl&amp;order=asc&amp;sort=postusername">$vbphrase[thread_starter]</a> $sortarrow[postusername] /
<a href="$sorturl&amp;order=asc&amp;sort=dateline">Thread Date</a> $sortarrow[dateline]
</td>


As always, back up any files you will be changing.

What it does:

Adds the " / Thread Date" link to the fourm header - see the attached image. This allows the forum to be sorted by ascending date. Once selected the standard sort arrow will appear and allow the order to be changed to descending.

nexialys
01-27-2005, 05:18 PM
next times, do a little search before releasing a tool...

i will not even look at your code, but it's sure is a duplicate of one of my hacks:

https://vborg.vbsupport.ru/showthread.php?s=&threadid=68434
https://vborg.vbsupport.ru/showthread.php?s=&threadid=68382

tgmorris
01-27-2005, 06:24 PM
next times, do a little search before releasing a tool...

i will not even look at your code, but it's sure is a duplicate of one of my hacks:

https://vborg.vbsupport.ru/showthread.php?s=&threadid=68434
https://vborg.vbsupport.ru/showthread.php?s=&threadid=68382
Well, excuuuuuuze me. :)

I did a brief search and came up empty. Since no one has posted any help to the requests for such a feature over at vb.com I thought I'd do this to be nice.

Oh, and there's really no reason to be so gd rude about it as it's a very simple modification that's I'm sure you had little trouble with. Hopefully my version would live up to your exceedingly high standards. /sarcasm :ermm:

nexialys
01-27-2005, 06:32 PM
why in the world is someone not add smilies it is supposed to be rude ?!

this was a simple comment... read it back without sensing being attacked please!

;) ;)

... and no, i don't care about standards... but yes, a $vbphrase would have helped...

rookie7
01-28-2005, 12:02 AM
Releasing another mod doesn't kill anyone, does it? Accusing someone of stealing your codes without even looking at their codes is pretty rude in my book. If you don't have anything good to say, please don't say it at all. It's people like you that prevent other people from sharing their talents.

Nice mod by the way.

nexialys
01-28-2005, 08:08 AM
It's people like you that prevent other people from sharing their talents.something to say to me, please use the PM. something off-topic doesn't have to be discussed on the thread either.

discussion closed.

zurih
01-28-2005, 08:12 PM
useful mod, installed! :)