Modification Title: Top And Close Threads On Reply v1.0

Modification Description:
This modification provides an option for staff to top and close threads on quick reply.
This modification provides an option for staff to top threads on reply.

Supported Version: XMB 1.9.8 SP3

Mod Author: John Briggs

Installation Note: Before adding this modification to your forum you should back up all files related to this modification.

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

Author Note:
Please check: http://www.xmbgarage.com for the latest version of this modification.
Downloading this modification from other sites could cause malicious code to enter into your XMB Forum.
As such, XMB Garage will not offer support for modifications not offered at our web site located at: http://www.xmbgarage.com

=======================================================================================================================
=======
Step 1:
=======
===============
Edit File: post.php
===============
========================
Find Code (First Instance Only):
========================

                if ((X_STAFF) && $closetopic == 'yes') {
                    $db->query("UPDATE ".X_PREFIX."threads SET closed='yes' WHERE tid='$tid' AND fid='$fid'");
                }

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

                // Top And Close Threads On Reply Mod Begin
                if ((X_STAFF) && $toptopic == 'yes') {
                    $db->query("UPDATE ".X_PREFIX."threads SET topped='1' WHERE tid='$tid' AND fid='$fid'");
                }
                if ((X_STAFF) && $closetopic == 'yes') {
                    $db->query("UPDATE ".X_PREFIX."threads SET closed='yes' WHERE tid='$tid' AND fid='$fid'");
                }
                // Top And Close Threads On Reply Mod End

==========
Find Code:
==========

            if (X_STAFF) {
                $closeoption = '<br /><input type="checkbox" name="closetopic" value="yes" '.$closecheck.' /> '.$lang['closemsgques'].'<br />';
            } else {
                $closeoption = '';
            }

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

            // Top And Close Threads On Reply Mod Begin
            if (X_STAFF) {
                $topoption   = '<br /><input type="checkbox" name="toptopic" value="yes" '.$topcheck.' /> '.$lang['topmsgques'].'';
                $closeoption = '<br /><input type="checkbox" name="closetopic" value="yes" '.$closecheck.' /> '.$lang['closemsgques'].'';
            } else {
                $topoption   = '';
                $closeoption = '';
            }
            // Top And Close Threads On Reply Mod Begin

=======================================================================================================================
=======
Step 2:
=======
===================
Edit File: viewthread.php
===================
==========
Find Code:
==========

if ($action == '') {
    if (X_MEMBER && $self['sig'] != '') {
        $usesig = true;
    }

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

    // Top And Close Threads On Reply Mod Begin
    if (X_STAFF) {
        if (isset($toptopic) && $toptopic == 'yes') {
            //$topcheck = 'checked="checked"';
            $topcheck = $cheHTML;
        } else {
            $topcheck = '';
            $toptopic = 'no';
        }

        if (isset($closetopic) && $closetopic == 'yes') {
            $closecheck = 'checked="checked"';
        } else {
            $closecheck = '';
            $closetopic = 'no';
        }
    } else {
        $topcheck   = '';
        $closecheck = '';
    }

    if (X_STAFF) {
        $topoption   = '<tr><td width="15%"><div align="left"><input type="checkbox" name="toptopic" value="yes" '.$topcheck.' /></div></td><td width="85%"> <div align="left">'.$lang['topmsgques'].'</div></td></tr>';
        $closeoption = '<tr><td width="15%"><div align="left"><input type="checkbox" name="closetopic" value="yes" '.$closecheck.' /></div></td><td width="85%"> <div align="left">'.$lang['closemsgques'].'</div></td></tr>';
    } else {
        $topoption   = '';
        $closeoption = '';
    }
    // Top And Close Threads On Reply Mod End

=======================================================================================================================
=======
Step 3:
=======

==============================
Go To Administration Panel-->Templates
==============================
===================
Edit Template:post_reply
===================
==========
Find Code:
==========

$closeoption

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

$topoption$closeoption

=======================================================================================================================
=======
Step 4:
=======
===============================
Go To Administration Panel-->Templates
===============================
============================
Edit Template: viewthread_quickreply
============================
==========
Find Code:
==========

<tr>
<td width="15%"> <div align="left"><input type="checkbox" name="emailnotify" value="yes" /></div></td>
<td width="85%"> <div align="left">$lang[textemailnotify] </div></td>
</tr>

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

$topoption$closeoption

=======================================================================================================================
Enjoy!