Sort forum by thread date
This modification is in the archives.
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. Code:
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'; } Code:
<td class="thead" width="100%"> <if condition="$show['threadratings']"><span style="float:$stylevar[right]"><a href="$sorturl&order=desc&sort=voteavg">$vbphrase[rating]</a> $sortarrow[voteavg]</span></if> <a href="$sorturl&order=asc&sort=title">$vbphrase[thread]</a> $sortarrow[title] / <a href="$sorturl&order=asc&sort=postusername">$vbphrase[thread_starter]</a> $sortarrow[postusername] / <a href="$sorturl&order=asc&sort=dateline">Thread Date</a> $sortarrow[dateline] </td> 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. Download No files for download. Screenshots
|