Name: Forum Based Auto Close New Threads v1.0

Description:
This modification will add a new option to forum options which automatically closes new threads.
This modification can be turned on/off on a per forum basis.

Compatibility: XMB v1.9.11

Tested On: XMB 1.9.11

Code Developed By: Adam Clarke (http://www.scriptdesign.co.uk & http://www.adam-clarke.co.uk)

Modification History: V1.0 (19/06/2005 @ 19:00) - Initial Release

License Note: This modification is released under the GPL License. A copy is provided with this software package.

Note: Backup all affected files, templates & database's.

Affected Files: cp.php, post.php, lang/English.lang.php

Affected Templates: NONE

=============================================================================================================================
=======
Step 1:
=======
====================================
Go To Administration Panel --> Insert Raw SQL
====================================

Upload SQL.txt and click Submit Changes.

====================================

==============================================================================================================================
=======
Step 2:
=======
==============
Edit File: cp.php
==============
======
Find:
======

        if ($forum['attachstatus'] == "on") {
            $checked6 = $cheHTML;
        } else {
            $checked6 = '';
        }

===========
Add Below:
===========

        // Forum Based Auto Close New Threads Mod Begin
        $closethreads_on = $closethreads_off = '';
        switch($forum['closethreads']) {
            case 'on':
                $closethreads_on = $selHTML;
                break;
            default:
                $closethreads_off = $selHTML;
                break;
        }
        // Forum Based Auto Close New Threads Mod End

================
Find (2nd Instance):
================

        <tr class="tablerow">
        <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['texttheme']?></td>
        <td bgcolor="<?php echo $altbg2?>"><?php echo $themelist?></td>
        </tr>

===========
Add Above:
===========

        <!-- Forum Based Auto Close New Threads Mod Begin -->
        <?php
        printsetting1($lang['closethreadsstatus'], 'closethreadsnew', $closethreads_on, $closethreads_off);
        ?>
        <!-- Forum Based Auto Close New Threads Mod End -->

======
Find:
======

        if ($newfname != $lang['textnewforum'] And $newfname != '') {
            $db->query("INSERT INTO ".X_PREFIX."forums (type, name, status, lastpost, moderator, displayorder, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, password) VALUES ('forum', '$newfname', '$newfstatus', '', '', $newforder, '', 'no', 'yes', 'yes', '', 0, 0, 0, $newffup, '31,31,31,63', 'yes', 'on', '')");
        }

=====================
Find Code In Above Code:
=====================

) VALUES ('forum',

============
Replace With:
============

, closethreads) VALUES ('forum',

=============================
Add Code To End Of Line Before: )");
=============================

, 'off'

======
Find:
======

        if ($newgname != $lang['textnewgroup'] And $newgname != '') {
            $db->query("INSERT INTO ".X_PREFIX."forums (type, name, status, lastpost, moderator, displayorder, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, password) VALUES ('group', '$newgname', '$newgstatus', '', '', $newgorder, '', '', '', '', '', 0, 0, 0, 0, '', '', '', '')");
        }

=====================
Find Code In Above Code:
=====================

) VALUES ('forum',

============
Replace With:
============

, closethreads) VALUES ('forum',

=============================
Add Code To End Of Line Before: )");
=============================

, 'off'

======
Find:
======

        if ($newsubname != $lang['textnewsubf'] And $newsubname != '') {
            $db->query("INSERT INTO ".X_PREFIX."forums (type, name, status, lastpost, moderator, displayorder, description, allowhtml, allowsmilies, allowbbcode, userlist, theme, posts, threads, fup, postperm, allowimgcode, attachstatus, password) VALUES ('sub', '$newsubname', '$newsubstatus', '', '', $newsuborder, '', 'no', 'yes', 'yes', '', 0, 0, 0, $newsubfup, '31,31,31,63', 'yes', 'on', '')");
        }

=====================
Find Code In Above Code:
=====================

) VALUES ('forum',

============
Replace With:
============

, closethreads) VALUES ('forum',

=============================
Add Code To End Of Line Before: )");
=============================

, 'off'

======
Find:
======

        $attachstatusnew = formOnOff('attachstatusnew');

===========
Add Below:
===========

        // Forum Based Auto Close New Threads Mod Begin
        $closethreadsnew = formOnOff('closethreadsnew');
        // Forum Based Auto Close New Threads Mod End

======
Find:
======

        $db->query("UPDATE ".X_PREFIX."forums SET

============
Replace With:
============

            closethreads='$closethreadsnew',

=============================================================================================================================
=======
Step 3:
=======
===============
Edit File: post.php
===============
======
Find:
======

            $moderator = (modcheck($username, $forum['moderator']) == 'Moderator');
            if ($moderator && $closetopic == 'yes') {
                $db->query("UPDATE ".X_PREFIX."threads SET closed='yes' WHERE tid='$tid' AND fid='$fid'");
            }

============
Replace With:
============

            $moderator = (modcheck($username, $forum['moderator']) == 'Moderator');
            if ($moderator && $closetopic == 'yes' || $forum['closethreads'] == 'on') {
                $db->query("UPDATE ".X_PREFIX."threads SET closed='yes' WHERE tid='$tid' AND fid='$fid'");
            }

=============================================================================================================================
=======
Step 8:
=======
===========================
Go To Admin Panel --> Translations
===========================
===================
Download Language File
===================
===============
Edit Language File
===============

============================
Add Code To End Of File Above ?>
============================

// Forum Based Auto Close New Threads Mod Begin
$lang['closethreadsstatus'] = 'Auto Close New Threads Status:';
// // Forum Based Auto Close New Threads Mod Begin

=========================================================
Go To Admin Panel -> Translations & Upload Language File:
=========================================================
=============================================================================================================================
Enjoy!