Static Topics

A perfect place for code snippets to small to be a MOD or a library.
Or for examples on how to use our libraries.
Post Reply
Elglobo
Past Contributor
Past Contributor
Posts: 120
Joined: 15 Jul 2008, 19:42

Static Topics

Post by Elglobo »

This post was originally posted by Kenny at 6 String MODs.

These 2 little code snippets allow you to change the way topics are ordered in your forums.
The 1st snippet changes all forums and the 2nd allows you to customise which forums stay static. By static, I mean the order in which the topics were created - topic_time

Snippet 1

OPEN: viewforum.php
FIND:

Code: Select all

$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');

REPLACE WITH:

Code: Select all

$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');


Snippet 2

OPEN: viewforum.php
FIND:

Code: Select all

$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');

REPLACE WITH:

Code: Select all

$static_forums = array(1, 2, 3); // replace 1, 2, 3 with your forum ID's.
if (in_array($forum_id, $static_forums))
{
   $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
}
else
{
   $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
}
Post Reply