============================================================================================================================
Modification Name: Forum Age Restriction

Version: 1.0

Author: GuldantheWarlock (GuldantheWarlock@xmbgarage.com) and WormHole

Last Updated: January 30, 2011

Description: This modification will allow administrators to set an age limit requirement to enter a forum.

Supported Version: XMB 1.9.5 SP1

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

Notes:
Please backup your files before installing this modification.
Neither XMBGarage nor the author can be held responsible if your board stops functioning properly due to you installing this modification.
============================================================================================================================
=======
Step 1:
=======
===================================
Go To Administration Panel --> Insert Raw SQL
===================================
===================================
Paste The Following Code and Submit Changes:
===================================

ALTER TABLE $table_forums ADD forumage INT(2) NOT NULL default '0';

============================================================================================================================
=======
Step 2:
=======
=======================
Edit File: lang/English.lang.php
=======================
========================
Add To End Of File Before  ?>
========================

// Forum Age Restriction Mod Begin
$lang['age_restriction'] = 'Minimum Age to view forum:<br /><span class="smalltxt"><em>(Set to 0 to disable)</em></span>';
$lang['age_restriction_eval'] = '$lang["age_restriction_error"] = "Sorry! You are not allowed to view this forum. You must be ".$forum["forumage"]." years of age or older.";';
$lang['age_restriction_bday'] = 'This forum has an age restriction. Please fill out your birthday in your profile.';
// Forum Age Restriction Mod End

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

        $forum['description'] = stripslashes($forum['description']);

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

        // Forum Age Restriction Mod Begin
        $forum['age'] = (int) $forum['age'];
        // Forum Age Restriction Mod End

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

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

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

        <!-- Forum Age Restriction Mod Begin -->
        <tr class="tablerow">
        <td bgcolor="<?php echo $altbg1?>"><?php echo $lang['age_restriction']?></td>
        <td bgcolor="<?php echo $altbg2?>"><input type="text" name="forumagenew" value="<?php echo $forum['age']?>" /></td>
        </tr>
        <!-- Forum Age Restriction Mod End -->

=================
Find Code (3 Times):
=================

$db->query("INSERT INTO $table_forums

==========================
Find Code In Each Of The 3 Lines:
==========================

 ) VALUES ('forum'

=======================
Replace Code With (3 Times):
=======================

, forumage ) VALUES ('forum',

=============================
Find Code At End Of All 3 Statements:
=============================

)");

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

, '0')");

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

            $descnew = addslashes($descnew);

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

            // Forum Age Restriction Mod Begin
            $forumagenew = (int) $forumagenew;
            // Forum Age Restriction Mod Begin

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

$db->query("UPDATE $table_forums SET name='$namenew', description='$descnew',

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

 WHERE fid='$fdetails'");

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

, forumage='$forumagenew' WHERE fid='$fdetails'");

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

eval('echo "'.template('header').'";');

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

// Forum Age Restriction Mod Begin
if ($forum['forumage'] > 0) {
    list($year,,) = explode('-', $self['bday']);
    $age = date('Y') - $year;

    if ($self['bday'] == '0000-00-00') {
        error($lang['age_restriction_bday']);
    }

    if ($age < $forum['forumage'] && !X_ADMIN) {
        eval($lang['age_restriction_eval']);
        error($lang['age_restriction_error']);
    }
}
// Forum Age Restriction Mod End

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