/////////////////////////////////////////////      Topic Sorting (version 1.0.3)         ////---------------------------------------//// This mod allows admins to set the       //// way topics are sorted for display in   //// each forum.                                        ////---------------------------------------//// Written for and tested on phpBB 2.0.3 ////---------------------------------------////    By jordo   - [url=http://www.jordodesigns.com]http://www.jordodesigns.com[/url]      ////---------------------------------------//// Modifies: SQL phpbb_forums table         //// viewforum.php, admin_forums.php,         //// forum_edit_body.tpl, lang_admin.php    /////////////////////////////////////////////      // SQL Changes:     ALTER TABLE `database_name_here`.`phpbb_forums` ADD `forum_sort` TEXT NOT NULL    /////////////////////// in viewforum.php      // replace:  $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time       FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2      WHERE t.forum_id = $forum_id            AND t.topic_poster = u.user_id            AND p.post_id = t.topic_first_post_id            AND p2.post_id = t.topic_last_post_id            AND u2.user_id = p2.poster_id             AND t.topic_type </option> $prune_enabled,  // add:                          'S_SORT_ORDER' => $sort_order,  // after:                          'L_DAYS' => $lang['Days'],  // add:                          'L_SORT' => $lang['Sort'],    // replace:                    $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")                        VALUES ('" . $next_id . "', '" . str_replace("'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";  // with:                    $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, forum_sort, prune_enable" . $field_sql . ")                        VALUES ('" . $next_id . "', '" . str_replace("'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ",   '" . str_replace("'", "''", $HTTP_POST_VARS['forumsort']) . "', " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";  // replace:                          SET forum_name = '" . str_replace("'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "  // with:                        SET forum_name = '" . str_replace("'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", forum_sort = '" . str_replace("'", "''", $HTTP_POST_VARS['forumsort']) . "', prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "    /////////////////////// in forum_edit_body.tpl  // after:        <tr>          <td>{L_FORUM_STATUS}</td>         <td><select>{S_STATUS_LIST}</select></td>      </tr>    // add:        <tr>          <td>{L_SORT}</td>         <td><select>{S_SORT_ORDER}</select></td>      </tr>    /////////////////////// in lang_admin.php  // after:  $lang['Status_unlocked'] = 'Unlocked';  // add:  $lang['Sort_alpha'] = 'Alphabetically';$lang['Sort_fpdate'] = 'Chronologically';$lang['Sort'] = 'Topic Display Sort Method';          ////////////////////////  // Now you are done!