Hmmm...
I forgot to comment the rest of the delete_topic function. So it was closing the topic and deleting any posts in it.
It's working now!
Try it!
1. Open include/functions.php
2. Find line 378
Before:
//
// Delete a topic and all of it's posts
//
function delete_topic($topic_id)
{
global $db;
// Delete the topic and any redirect topics
$db->query('DELETE FROM '.$db->prefix.'topics WHERE id='.$topic_id.' OR moved_to='.$topic_id) or error('Unable to delete topic', __FILE__, __LINE__, $db->error());
// Create a list of the post ID's in this topic
$post_ids = '';
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$topic_id) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());
while ($row = $db->fetch_row($result))
$post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0];
// Make sure we have a list of post ID's
if ($post_ids != '')
{
strip_search_index($post_ids);
// Delete posts in topic
$db->query('DELETE FROM '.$db->prefix.'posts WHERE topic_id='.$topic_id) or error('Unable to delete posts', __FILE__, __LINE__, $db->error());
}
// Delete any subscriptions for this topic
$db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE topic_id='.$topic_id) or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error());
}
After:
//
// Delete a topic and all of it's posts
//
function delete_topic($topic_id)
{
global $db;
// Delete the topic and any redirect topics
// $db->query('DELETE FROM '.$db->prefix.'topics WHERE id='.$topic_id.' OR moved_to='.$topic_id) or error('Unable to delete topic', __FILE__, __LINE__, $db->error());
$db->query('UPDATE '.$db->prefix.'topics SET closed=1 WHERE id='.$topic_id) or error('Unable to close topic', __FILE__, __LINE__, $db->error());
/*
// Create a list of the post ID's in this topic
$post_ids = '';
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$topic_id) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());
while ($row = $db->fetch_row($result))
$post_ids .= ($post_ids != '') ? ','.$row[0] : $row[0];
// Make sure we have a list of post ID's
if ($post_ids != '')
{
strip_search_index($post_ids);
// Delete posts in topic
$db->query('DELETE FROM '.$db->prefix.'posts WHERE topic_id='.$topic_id) or error('Unable to delete posts', __FILE__, __LINE__, $db->error());
}
// Delete any subscriptions for this topic
$db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE topic_id='.$topic_id) or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error());
*/
}
Don't forget to replace "Delete" with "Close" where needed (language files).
Downside: you no longer can delete topics!