Seite 1 von 1

Topic Display Order (BUG?)

Verfasst: 27.09.2007 10:00
von AzadKing
Hallo,

weiß jemand zu helfen ?

Also ich habe 10 x den gleichen Threadnamen nur halt nummeriert von

1-10

nun macht er aber den Fehler das er

XXX 10
XXX 2
XXX 3
XXX 4
XXX 5
XXX 6
XXX 7
XXX 8
XXX 9
XXX 1

Also die 10 als erstes und die 1 am Ende. Weiß jemand wie ich das beheben kann ?

Verfasst: 11.11.2007 17:42
von AzadKing
bump

Verfasst: 11.11.2007 17:49
von AzadKing
Ohh habe gerade gesehen das es nicht der Mod ist sonder der
///////////////////////////////////////////
// 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 - http://www.jordodesigns.com //
//---------------------------------------//
// 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 <> " . POST_ANNOUNCE . "
$limit_topics_time
ORDER BY t.topic_type DESC, t.topic_last_post_id DESC
LIMIT $start, ".$board_config['topics_per_page'];

// with:

if ($forum_row['forum_sort'] == "SORT_ALPHA")
{
$topic_order = "t.topic_title";
}
else
{
$topic_order = "t.topic_last_post_id DESC";
}
$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 <> " . POST_ANNOUNCE . "
$limit_topics_time
ORDER BY t.topic_type DESC, $topic_order
LIMIT $start, ".$board_config['topics_per_page'];



/////////////////////// in admin_forums.php

// after:

$forumstatus = $row['forum_status'];

// add:

$forumsort = $row['forum_sort'];

// before:

$forumstatus == ( FORUM_LOCKED ) ? $forumlocked = "selected=\"selected\"" : $forumunlocked = "selected=\"selected\"";

// add:

$forumsort == ( SORT_ALPHA ) ? $sortalpha = "selected=\"selected\"" : $sortfpdate = "selected=\"selected\"";
$sort_order = "<option value=\"" . SORT_ALPHA . "\" $sortalpha>" . $lang['Sort_alpha'] . "</option>\n";
$sort_order .= "<option value=\"" . SORT_FPDATE . "\" $sortfpdate>" . $lang['Sort_fpdate'] . "</option>\n";

// after:

'S_PRUNE_ENABLED' => $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 class="row1">{L_FORUM_STATUS}</td>
<td class="row2"><select name="forumstatus">{S_STATUS_LIST}</select></td>
</tr>


// add:

<tr>
<td class="row1">{L_SORT}</td>
<td class="row2"><select name="forumsort">{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!