<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[PunBB Forums — Instead of deleting a topic, how about closing it?]]></title>
		<link>https://punbb.informer.com/forums/topic/17294/instead-of-deleting-a-topic-how-about-closing-it/</link>
		<atom:link href="https://punbb.informer.com/forums/feed/rss/topic/17294/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Instead of deleting a topic, how about closing it?.]]></description>
		<lastBuildDate>Mon, 15 Oct 2007 18:03:28 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Instead of deleting a topic, how about closing it?]]></title>
			<link>https://punbb.informer.com/forums/post/101986/#p101986</link>
			<description><![CDATA[<p>Hmmm...</p><p>I forgot to comment the rest of the delete_topic function. So it was closing the topic and deleting any posts in it.<br />It&#039;s working now!</p><p>Try it!</p><p>1. Open include/functions.php<br />2. Find line 378</p><p>Before:</p><div class="codebox"><pre><code>//
// Delete a topic and all of it&#039;s posts
//
function delete_topic($topic_id)
{
    global $db;

    // Delete the topic and any redirect topics
    $db-&gt;query(&#039;DELETE FROM &#039;.$db-&gt;prefix.&#039;topics WHERE id=&#039;.$topic_id.&#039; OR moved_to=&#039;.$topic_id) or error(&#039;Unable to delete topic&#039;, __FILE__, __LINE__, $db-&gt;error());

    // Create a list of the post ID&#039;s in this topic
    $post_ids = &#039;&#039;;
    $result = $db-&gt;query(&#039;SELECT id FROM &#039;.$db-&gt;prefix.&#039;posts WHERE topic_id=&#039;.$topic_id) or error(&#039;Unable to fetch posts&#039;, __FILE__, __LINE__, $db-&gt;error());
    while ($row = $db-&gt;fetch_row($result))
        $post_ids .= ($post_ids != &#039;&#039;) ? &#039;,&#039;.$row[0] : $row[0];

    // Make sure we have a list of post ID&#039;s
    if ($post_ids != &#039;&#039;)
    {
        strip_search_index($post_ids);

        // Delete posts in topic
        $db-&gt;query(&#039;DELETE FROM &#039;.$db-&gt;prefix.&#039;posts WHERE topic_id=&#039;.$topic_id) or error(&#039;Unable to delete posts&#039;, __FILE__, __LINE__, $db-&gt;error());
    }

    // Delete any subscriptions for this topic
    $db-&gt;query(&#039;DELETE FROM &#039;.$db-&gt;prefix.&#039;subscriptions WHERE topic_id=&#039;.$topic_id) or error(&#039;Unable to delete subscriptions&#039;, __FILE__, __LINE__, $db-&gt;error());
}</code></pre></div><p>After:</p><div class="codebox"><pre><code>//
// Delete a topic and all of it&#039;s posts
//
function delete_topic($topic_id)
{
    global $db;

    // Delete the topic and any redirect topics
//    $db-&gt;query(&#039;DELETE FROM &#039;.$db-&gt;prefix.&#039;topics WHERE id=&#039;.$topic_id.&#039; OR moved_to=&#039;.$topic_id) or error(&#039;Unable to delete topic&#039;, __FILE__, __LINE__, $db-&gt;error());
    $db-&gt;query(&#039;UPDATE &#039;.$db-&gt;prefix.&#039;topics SET closed=1 WHERE id=&#039;.$topic_id) or error(&#039;Unable to close topic&#039;, __FILE__, __LINE__, $db-&gt;error());

/*
    // Create a list of the post ID&#039;s in this topic
    $post_ids = &#039;&#039;;
    $result = $db-&gt;query(&#039;SELECT id FROM &#039;.$db-&gt;prefix.&#039;posts WHERE topic_id=&#039;.$topic_id) or error(&#039;Unable to fetch posts&#039;, __FILE__, __LINE__, $db-&gt;error());
    while ($row = $db-&gt;fetch_row($result))
        $post_ids .= ($post_ids != &#039;&#039;) ? &#039;,&#039;.$row[0] : $row[0];

    // Make sure we have a list of post ID&#039;s
    if ($post_ids != &#039;&#039;)
    {
        strip_search_index($post_ids);

        // Delete posts in topic
        $db-&gt;query(&#039;DELETE FROM &#039;.$db-&gt;prefix.&#039;posts WHERE topic_id=&#039;.$topic_id) or error(&#039;Unable to delete posts&#039;, __FILE__, __LINE__, $db-&gt;error());
    }

    // Delete any subscriptions for this topic
    $db-&gt;query(&#039;DELETE FROM &#039;.$db-&gt;prefix.&#039;subscriptions WHERE topic_id=&#039;.$topic_id) or error(&#039;Unable to delete subscriptions&#039;, __FILE__, __LINE__, $db-&gt;error());
*/
}</code></pre></div><p>Don&#039;t forget to replace &quot;Delete&quot; with &quot;Close&quot; where needed (language files).</p><p><strong>Downside</strong>: you no longer can delete topics! <img src="https://punbb.informer.com/forums/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></description>
			<author><![CDATA[null@example.com (fmimoso)]]></author>
			<pubDate>Mon, 15 Oct 2007 18:03:28 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/101986/#p101986</guid>
		</item>
		<item>
			<title><![CDATA[Instead of deleting a topic, how about closing it?]]></title>
			<link>https://punbb.informer.com/forums/post/101985/#p101985</link>
			<description><![CDATA[<p>Hi,</p><p>I&#039;m wondering if it would be difficult for one to be able (permissions based) to close his own post.<br />Instead of having the ability to delete a whole topic, the user would only have the ability to close it.</p><p>Any thoughts?</p><p>I&#039;ve tried to replace the sql query in functions.php but it didn&#039;t work. What I did:</p><div class="codebox"><pre><code>// Delete the topic and any redirect topics
//$db-&gt;query(&#039;DELETE FROM &#039;.$db-&gt;prefix.&#039;topics WHERE id=&#039;.$topic_id.&#039; OR moved_to=&#039;.$topic_id) or error(&#039;Unable to delete topic&#039;, __FILE__, __LINE__, $db-&gt;error());
  $db-&gt;query(&#039;UPDATE &#039;.$db-&gt;prefix.&#039;topics SET closed=1 WHERE id=&#039;.$topic_id) or error(&#039;Unable to close topic&#039;, __FILE__, __LINE__, $db-&gt;error());</code></pre></div><p>I&#039;ve copied that query from moderate.php... <img src="https://punbb.informer.com/forums/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p><p>It indeed closes the topic but when clicking on it from viewforum.php I only get top_navlinks and bottom_navlinks with nothing between them... <img src="https://punbb.informer.com/forums/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /><br />Quite a programmer hey?</p><p>Anyone willing to help? I&#039;ll be paying with a lot of &quot;thank you&#039;s&quot;. <img src="https://punbb.informer.com/forums/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (fmimoso)]]></author>
			<pubDate>Mon, 15 Oct 2007 17:30:10 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/101985/#p101985</guid>
		</item>
	</channel>
</rss>
