============================================================================================================================
Modification Title: Username Length Control

Version: 3.0

Author: Jonathon of JDMnet ( jonathon@jdmnet.org | www.jdmnet.org )

Updated By: WormHole @ XMB Garage

Description:
Allows you to control how long; or short; of usernames you will allow people to register with.
 Minimum being 1 character, Maximum being 255 characters.

Copyright:  2010 XMB Garage. All Rights Reserved.

Compatibility: XMB 1.9.5 SP1

Install 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 v3. A copy is provided with this software package.

Author Notes:
This modification is developed and released for use with XMB 1.9.5 SP1 which is provided by XMBGarage.com.
Please backup your files, templates and database before installing this modification.
Neither XMB Garage nor the author can be held responsible if your board stops functioning properly due to you installing this modification.
============================================================================================================================
=======
Step 1:
=======
=================
Edit File: member.php
=================
==========
Find Code:
==========

            eval('echo stripslashes("'.template('member_reg').'");');

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

            // Username Length Control Mod Begin
            $max_length = $length = $username_control = '';
            if ($SETTINGS['namecontrol'] == 'on') {
                // controls the length of the username box -- if turned "on"
                $max_length = $SETTINGS['namelength'];
                $length = ($SETTINGS['namelength'] + 8);

                $username_control = '<input type="text" name="username" size="' .$length. '" maxlength="' .$max_length. '" /><br />&nbsp;<small><em>' .$lang['namecontrol_text1'].$max_length. '.</e></small>';
            } elseif ($SETTINGS['namecontrol'] == 'off') {
                // default size if turned off
                // do not change this part
                $username_control = '<input type="text" name="username" size="25" maxlength="25" /><br />&nbsp;<small><em>' .$lang['namecontrol_text1']. ' 25.</e></small>';
            }
            // Username Length Control Mod End

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

        $onselect = $offselect = '';

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

        // Username Length Control Mod Begin
        $namecontrol_on = $namecontrol_off = '';
        switch ( $SETTINGS['namecontrol']) {
            case 'on':
                $namecontrol_on = $selHTML;
                break;
            default:
                $namecontrol_off = $selHTML;
                break;
        }
        // Username Length Control Mod End

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

        printsetting1($lang['doublee'], 'doubleenew', $doubleeon, $doubleeoff);

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

        // Username Length Control Mod Begin
        printsetting1($lang['namecontrol_settings1'], 'namecontrol_new', $namecontrol_on, $namecontrol_off);
        printsetting2($lang['namecontrol_settings2'], 'namecontrol_length_new', $SETTINGS['namelength'], 3);
        // Username Length Control Mod End

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

        $resetSigNew = ($resetSigNew == 'on') ? 'on' : 'off';

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

        // Username Length Control Mod Begin
        $namecontrol_new = ($namecontrol_new == 'on') ? 'on' : 'off';
        $namecontrol_length_new = (int) $namecontrol_length_new;
        // Username Length Control Mod End

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

$db->query("UPDATE $table_settings SET langfile='$langfilenew'

=======================
At The End Of The Line Find:
=======================

");

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

, namecontrol='$namecontrol_new', namelength='$namecontrol_length_new'");

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

// Username Length Control Mod Begin
$lang['namecontrol_text1'] = 'Maximum number of characters:';
$lang['namecontrol_settings1'] = "Control Length of Usernames?";
$lang['namecontrol_settings2'] = 'Max number of characters allowed:<br><small><em>Please note the above option must be selected. Plus, you cannot set the limit above 255</em></small>';
// Username Length Control Mod End

============================================================================================================================
=======
Step 4:
=======
===================================
Go To Administration Panel --> Insert Raw SQL
====================================
===============================
Add Code Into Box and Submit Changes:
===============================

ALTER TABLE `$table_members` CHANGE `username` `username` VARCHAR(225) NOT NULL;
ALTER TABLE `$table_settings` 
 ADD `namecontrol` CHAR(3) DEFAULT 'off' NOT NULL,
 ADD `namelength` INT(3) DEFAULT '25' NOT NULL;

============================================================================================================================
=======
Step 5:
=======
===============================
Go To Administration Panel --> Templates
===============================
=====================
Edit Template: member_reg
=====================
==========
Find Code:
==========

<input type="text" name="username" size="25" maxlength="25" />

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

$username_control

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