Title: Auto Subscribe To Threads Option v1.0

Author: John Briggs

Description:
This modification will provide an option in member control panel for members to choose to auto subscribe to threads on posting.
This modification will auto-check the checkbox in post reply and quick reply to Receive an email on reply.

Copyright:  2006 John Briggs. All rights reserved.

Compatability: XMB 1.9.8 Engage Final SP2/SP3

Updated for 1.9.8 by: WormHole @ XMB Garage

Install Note: Before adding this mod to your forum, you should back up all files related to this mod.

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

Author Note:
You downloaded this hack from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.

=======================================================================================================================================
=======
Step 1:
=======

===================================
Go To Admin Panel -> Insert Raw SQL
===================================

Upload provided file named "SQL.txt" & click "Submit Changes" button.

=======================================================================================================================================
=======
Step 2:
=======

==========================
Edit File: editprofile.php
==========================

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

    $eouchecked = '';
    if ($member['emailonu2u'] == 'yes') {
        $eouchecked = $cheHTML;
    }

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

    // Auto Subscribe To Threads Option Mod Begin
    $autosubchecked = '';
    if ($member['autosub'] == 'yes') {
        $autosubchecked = $cheHTML;
    }
    // Auto Subscribe To Threads Option Mod End

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

    $useoldu2u = formYesNo('useoldu2u');

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

    // Auto Subscribe To Threads Option Mod Begin
    $autosub = formYesNo('autosub');
    // Auto Subscribe To Threads Option Mod End

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

    $db->query("UPDATE ".X_PREFIX."members SET email='$email',

====================================
Find Code At End Of Above Statement:
====================================

 WHERE username='$user'");

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

, autosub='$autosub' WHERE username='$user'");

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

====================
Edit File: memcp.php
====================

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

        $invchecked = '';
        if ($member['invisible'] == 1) {
            $invchecked = $cheHTML;
        }

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

        // Auto Subscribe To Threads Option Mod Begin
        $autosubchecked = '';
        if ($member['autosub'] == 'yes') {
            $autosubchecked = $cheHTML;
        }
        // Auto Subscribe To Threads Option Mod End

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

        $useoldu2u = formYesNo('useoldu2u');

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

        // Auto Subscribe To Threads Option Mod Begin
        $autosub = formYesNo('autosub');
        // Auto Subscribe To Threads Option Mod End

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

        $db->query("UPDATE ".X_PREFIX."members SET $pwtxt email='$email',

====================================
Find Code At End Of Above Statement:
====================================

 WHERE username='$xmbuser'");

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

, autosub='$autosub' WHERE username='$xmbuser'");

=======================================================================================================================================
=======
Step 4:
=======

=====================
Edit File: member.php
=====================

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

            $useoldu2u = formYesNo('useoldu2u');

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

            // Auto Subscribe To Threads Option Mod Begin
            $autosub = formYesNo('autosub');
            // Auto Subscribe To Threads Option Mod End

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

                $db->query("INSERT INTO ".X_PREFIX."members (username,

=====================================
Find Code In-Line In Above Statement:
=====================================

) VALUES ('$username',

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

, autosub) VALUES ('$username',

==========================================
Find Code At End Of Above Query Statement:
==========================================

)");

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

, '$autosub')");

=======================================================================================================================================
=======
Step 5:
=======

=========================
Edit File: viewthread.php
=========================

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

    $usesigcheck = $usesig ? 'checked="checked"' : '';

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

    // Auto Subscribe To Threads Option Mod Begin
    $autosubcheck = (isset($self['autosub']) && $self['autosub'] == 'yes') ? 'checked="checked"' : '';
    $self['autosub'] = (isset($self['autosub']) && $self['autosub'] == 'yes') ? 'yes' : 'no';
    // Auto Subscribe To Threads Option Mod End

=======================================================================================================================================
=======
Step 6:
=======

===================
Edit File: post.php
===================

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

if (isset($emailnotify) && $emailnotify == 'yes') {
    $emailnotifycheck = $cheHTML;
} else {
    $emailnotifycheck = '';
    $emailnotify = 'no';
}

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

// Auto Subscribe To Threads Option Mod Begin
if (isset($self['autosub']) && $self['autosub'] == 'yes') {
    $autosubcheck = $cheHTML;
} else {
    $autosubcheck = '';
    $self['autosub'] = 'no';
}
// Auto Subscribe To Threads Option Mod End

// Auto Subscribe To Threads Option Mod 
$autosubcheck = (isset($self['autosub']) && $self['autosub'] == 'yes') ? $cheHTML : '';
$self['autosub'] = (isset($self['autosub']) && $self['autosub'] == 'yes') ? 'yes' : 'no';
// Auto Subscribe To Threads Option Mod

=========================
Find Code 2nd & 3rd Occasions:
=========================

if (isset($emailnotify) && $emailnotify == 'yes') {

==============================
Replace Code With On Both Occasions:
==============================

if (isset($emailnotify) && $emailnotify == 'yes' || isset($self['autosub']) && $self['autosub'] == 'yes') {

=======================================================================================================================================
=======
Step 7:
=======

================================
Edit File: lang/English.lang.php
================================

================================
Add Code At Very Bottom Of File:
================================

// Auto Subscribe To Threads Option Mod Begin
$lang['autosub'] = "Auto subscribe to all threads you post in?";
// Auto Subscribe To Threads Option Mod End

=======================================================================================================================================
=======
Step 8:
=======

=======================================================
Go to admin panel -> templates -> viewthread_quickreply
=======================================================

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

<td width="15%"> <div align="left"><input type="checkbox" name="emailnotify" value="yes" /></div></td>

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

<td width="15%"> <div align="left"><input type="checkbox" name="emailnotify" value="yes" $autosubcheck /></div></td>

=======================================================================================================================================
=======
Step 9:
=======

================================================
Go to admin panel -> templates -> post_newthread
================================================

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

<input
type="checkbox" name="emailnotify" value="yes" $emailnotifycheck />

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

<input
type="checkbox" name="emailnotify" value="yes" $emailnotifycheck $autosubcheck />

=======================================================================================================================================
========
Step 10:
========

============================================
Go to admin panel -> templates -> post_reply
============================================

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

<input type="checkbox" name="emailnotify" value="yes" $emailnotifycheck/>

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

<input type="checkbox" name="emailnotify" value="yes" $emailnotifycheck $autosubcheck />

=======================================================================================================================================
========
Step 11:
========

==============================================
Go to admin panel -> templates -> post_newpoll
==============================================

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

<input type="checkbox" name="emailnotify" value="yes" />

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

<input type="checkbox" name="emailnotify" value="yes" $emailnotifycheck $autosubcheck />

=======================================================================================================================================
========
Step 12:
========

=======================================================
Go to admin panel -> templates -> admintool_editprofile
=======================================================

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

<input type="checkbox" name="emailonu2u" value="yes" $eouchecked /> $lang[textemailonu2u]<br />

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

<input type="checkbox" name="autosub" value="yes" $autosubchecked /> $lang[autosub]<br />

=======================================================================================================================================
========
Step 13:
========

============================================
Go to admin panel -> templates -> member_reg
============================================

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

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textemailonu2u]</td>
<td bgcolor="$altbg2"><input type="checkbox" name="emailonu2u" value="yes" /></td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[autosub]</td>
<td bgcolor="$THEME[altbg2]"><input type="checkbox" name="autosub" value="yes" /></td>
</tr>

=======================================================================================================================================
========
Step 13:
========

===============================================
Go to admin panel -> templates -> memcp_profile
===============================================

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

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textemailonu2u]</td>
<td bgcolor="$altbg2"><input type="checkbox" name="emailonu2u" value="yes" $eouchecked /></td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[autosub]</td>
<td bgcolor="$altbg2"><input type="checkbox" name="autosub" value="yes" $autosubchecked /></td>
</tr>

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