Hi,
ich würde in viewtopic.php die DB-Anfrage anpassen:
wird zu:
Dann:
Code: Alles auswählen
//
// Send vars to template
//
$template->assign_vars(array(
'FORUM_ID' => $forum_id,
danach einfügen (Bild anpassen):
Code: Alles auswählen
'DONE_BUTTON' => ($userdata['user_id'] == $topic['topic_poster'] && ($forum_id == 58 || $forum_id == 75)) ? ('<a href="' . append_sid("done.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '"><img ENTSPRECHEND ANPASSEN></a>') : '',
Neue Datei done.php (zitier meinen Beitrag, dann ist er auch richtig formatiert):
Code: Alles auswählen
<?php
// phpbb
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
// start session management
$userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata);
// vars
$topic_id = isset($_GET[POST_TOPIC_URL]) ? intval($_GET[POST_TOPIC_URL]) : 0;
if (!$userdata['session_logged_in'] || !$topic_id) {
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
// auth topic poster
$sql = 'SELECT topic_id
FROM ' . TOPICS_TABLE . '
WHERE topic_id = ' . intval($topic_id) . '
AND topic_poster = ' . intval($userdata['user_id']);
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}
if (!($row = $db->sql_fetchrow($result))) {
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
// lock topic
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_status = ' . TOPIC_LOCKED . '
WHERE topic_id = ' . intval($topic_id) . '
AND topic_moved_id = 0';
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, "Could not update topic status.", '', __LINE__, __FILE__, $sql);
}
// display message
$message = sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
$message .= '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">')
);
message_die(GENERAL_MESSAGE, $lang['Topics_Locked'] . '<br /><br />' . $message);
?>
Bei Bedarf könnte man noch eine "Bist Du sicher, dass Du Dein Angebot schließen möchtest..." Frage vorschalten.
Zuletzt würde ich die DB-Abfrage von viewforum.php anpassen:
wird zu:
Code: Alles auswählen
ORDER BY " . ($forum_id != 58 && $forum_id != 75) ? "" : "t.topic_status ASC, ") . "t.topic_type DESC, t.topic_last_post_id DESC
Auf die Art werden im Forum erst die offenen Angebote aufgelistet und anschließend die geschlossenen (also bevorzugt vor der Sortierung nach Datum).
Das sollte soweit alles sein. Einen Button muss allerdings jemand anderes machen
P.S. Dankesreden könnt ihr Euch sparen, ich nehme nur Links für meine
Honda Händler-Liste.
P.P.S. Ich habe die Erfahrung gemacht, dass die Leute die Buttons auf der rechten Seite übersehen. Es würde also vielleicht Sinn machen den Button dort zu platzieren, wo auch

angezeigt wird.
EDIT:
Ich hab noch was vergessen:
In die viewtopic.php muss noch ein DB-Update rein, dass die Angebote automatisch nach 60 Tagen (5184000 Sekunden) geschlossen werden:
Code: Alles auswählen
// lock topic
if (($forum_id == 58 || $forum_id == 75) && $forum_topic_data['topic_status'] == TOPIC_UNLOCKED && $forum_topic_data['topic_time'] < (time() - 5184000)) {
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_status = ' . TOPIC_LOCKED . '
WHERE topic_id = ' . intval($topic_id) . '
AND topic_moved_id = 0';
if (!$db->sql_query($sql)) {
message_die(GENERAL_ERROR, "Could not update topic status.", '', __LINE__, __FILE__, $sql);
}
}
Damit Biete-Leute nicht einfach ihre Angebote ständig offen lassen. Wobei das ja theoretisch erwünscht sein könnte. Müsst Ihr entscheiden
