=======================================================================================================================================
Modification Title: Forum Based Restrict Guest Browsing

Modification Version: 1.0

Modification Author: John Briggs, WormHole

Modification Description:
This modification will restrict viewing of specific forums selected in the admin forum options to members only and block guests.

Modification Copyright:  2009 John Briggs, WormHole. All rights reserved.

Modification Compatibility: XMB 1.9.8 SP3/SP4

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

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

Modification Author Note:
This modification is developed and released for use with XMB 1.9.8 SP3/SP4 which is provided by John Briggs.
=======================================================================================================================================
=======
Step 1:
=======
==============================
Go To Admin Panel -> Insert Raw SQL
==============================

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

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

        $type31 = $type32 = $type33 = $type34 = '';
        if ($forum['private'] == 2) {
            $type32 = $selHTML;
        } else if ($forum['private'] == 3) {
            $type33 = $selHTML;
        } else if ($forum['private'] == 4) {
            $type34 = $selHTML;
        } else if ($forum['private'] == 1) {
            $type31 = $selHTML;
        }

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

        // Forum Based Restrict Guest Browsing Mod Begin
        $fmemonly_yes = $fmemonly_no = '';
        switch($forum['fmemonly']) {
            case 'yes':
                $fmemonly_yes = $selHTML;
                break;
            default:
                $fmemonly_no = $selHTML;
                break;
        }
        // Forum Based Restrict Guest Browsing Mod Begin

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

        <tr class="tablerow">
        <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['textdesc']?></td>
        <td bgcolor="<?php echo $altbg2?>"><textarea rows="4" cols="30" name="descnew"><?php echo htmlspecialchars_decode($forum['description'])?></textarea></td>
        </tr>

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

        <!-- Forum Based Restrict Guest Browsing Mod Begin -->
        <tr class="tablerow">
        <td bgcolor="<?php echo $THEME['altbg1']?>"><?php echo $lang['fmemonlystatus']?></td>
        <td bgcolor="<?php echo $THEME['altbg2']?>">
        <select name="fmemonlynew">
        <option value="yes" <?php echo $fmemonly_yes?>><?php echo $lang['textyes']?></option>
        <option value="no" <?php echo $fmemonly_no?>><?php echo $lang['textno']?></option>
        </select>
        </td>
        </tr>
        <!-- Forum Based Restrict Guest Browsing Mod End -->

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

) VALUES ('forum',

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

, fmemonly) VALUES ('forum',

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

)");

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

, 'yes')");

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

) VALUES ('group',

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

, fmemonly) VALUES ('group',

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

)");

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

, 'yes')");

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

) VALUES ('sub',

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

, fmemonly) VALUES ('sub',

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

)");

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

, 'yes')");

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

        $guestpostingnew = formOnOff('guestpostingnew');

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

        // Forum Based Restrict Guest Browsing Mod Begin
        $fmemonlynew = formYesNo('fmemonlynew');
        // Forum Based Restrict Guest Browsing Mod End

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

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

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

        $db->query("UPDATE ".X_PREFIX."forums SET
            fmemonly='$fmemonlynew',

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

$forum = $db->fetch_array($query);

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

// Forum Based Restrict Guest Browsing Mod Begin
if (isset($forum['fmemonly']) && $forum['fmemonly'] != 'yes' && X_GUEST) {
    error($lang['fmemonlyerror']);
}
// Forum Based Restrict Guest Browsing Mod End

=======================================================================================================================================
=======
Step 4:
=======
=====================
Edit File: forumdisplay.php
=====================
==========
Find Code:
==========

$forum = $db->fetch_array($query);

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

// Forum Based Restrict Guest Browsing Mod Begin
if (isset($forum['fmemonly']) && $forum['fmemonly'] != 'yes' && X_GUEST) {
    error($lang['fmemonlyerror']);
}
// Forum Based Restrict Guest Browsing Mod End

=======================================================================================================================================
=======
Step 5:
=======
=======================
Edit File: lang/English.lang.php
=======================
============================
Add Code To End Of File Above ?>
============================

// Forum Based Restrict Guest Browsing Mod Begin
$lang['fmemonlystatus'] = "Allow guests to view this forum?";
$lang['fmemonlyerror'] = "Sorry! You must be registered or logged in to view this forum.";
// Forum Based Restrict Guest Browsing Mod End

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