Name: Post Minimum To Enable U2U v1.0

Compatibility: XMB v1.9.8 SP3

Tested On: XMB v1.9.8 SP3

Code Developed By: Jamie

Description: This modification will allow you to set a restriction so a member must have a certain number of posts before they're allowed to send u2us.
Staff Members are exempt from this restriction.

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

Note: Please ensure that you backup all affected files and your database prior to installing this modification.

Affected Files(3): u2u.php, English.lang.php, cp.php.

================================================================================================
======================================
Go To Administration Panel -> INSERT RAW SQL
======================================
=======================
Add Code & Submit Changes
=======================

ALTER TABLE `$table_settings` ADD `u2upmstatus` SET('on','off') DEFAULT 'off' NOT NULL;
ALTER TABLE `$table_settings` ADD `u2upmposts` SMALLINT(5) DEFAULT '0' NOT NULL;

================================================================================================
==============
Edit File: u2u.php
==============
======
Find:
======

        $msgto = postedVar('msgto', 'javascript', TRUE, TRUE, TRUE);

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

        // Post Minimum To Enable U2U Mod Begin
        if ($SETTINGS['u2upmstatus'] == 'on') {
            if (!X_STAFF && $self['postnum'] < $SETTINGS['u2upmposts']) {
               error($lang['u2upmmsg'], FALSE, $u2uheader, $u2ufooter, FALSE, TRUE, FALSE, FALSE); 
            }
        }
        // Post Minimum To Enable U2U Mod End

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

// Post Minimum To Enable U2U Mod Begin
$lang['u2upmstatus'] = "Post Minimum Needed to Send U2U's Status:";
$lang['u2upmposts'] = "Post Minimum Needed to Send U2U's:";
$lang['u2upmmsg'] = "You need a minimum of $SETTINGS[u2upmposts] posts to be able to send U2U messages!";
// Post Minimum To Enable U2U Mod End

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

        $tickerstatuson = $tickerstatusoff = '';
        settingHTML('tickerstatus', $tickerstatuson, $tickerstatusoff);

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

        // Post Minimum To Enable U2U Mod Begin
        $u2upmstatuson = $u2upmstatusoff = '';
        // Post Minimum To Enable U2U Mod End

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

        printsetting2($lang['textflood'], 'floodctrlnew', ((int)$SETTINGS['floodctrl']), 3);

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

        // Post Minimum To Enable U2U Mod Begin
        printsetting1($lang['mpu2ustatus'], 'u2upmstatusnew', $u2upmstatuson, $u2upmstatusoff);
        printsetting2($lang['u2upmposts'], "u2upmpostsnew", ((int)$SETTINGS['u2umpposts']), 5);
        // Post Minimum To Enable U2U Mod End

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

        $max_avatar_size_h_new = formInt('max_avatar_size_h_new');


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

        // Post Minimum To Enable U2U Mod Begin
        $u2upmpostsnew = formInt('u2upmpostsnew');
        // Post Minimum To Enable U2U Mod End

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

        $resetSigNew = formOnOff('resetSigNew');

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

        // Post Minimum To Enable U2U Mod Begin
        $u2upmstatusnew = formOnOff('$u2upmstatusnew');
        // Post Minimum To Enable U2U Mod End

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

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

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

        $db->query("UPDATE ".X_PREFIX."settings SET
            u2umpstatus='$u2umpstatusnew',
            u2umpposts='$u2umppostsnew',

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