=======================================================================================================
Modification Name: Harry Potter Random School Selection v1.0

Author: GuldantheWarlock @ XMB Garage

Description:
This modification will sort users into a school at random upon registration
It comes with the Harry Potter default options of: Beauxbatons, Durmstrang and Hogwarts.
This modification will show this selection in both profiles and posts.

Supported Version: XMB 1.9.8 SP3

Notes:
This modification is released under the GPL. You should have received a copy with this software package.

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 Admin Panel --> Insert Raw SQL
==============================
=============================
Paste the following code and hit submit
=============================

ALTER TABLE `$table_members` ADD `school` INT(1) NOT NULL default 0;
UPDATE `$table_members` SET school=FLOOR(1 + (RAND() * 3)) WHERE status != 'Super Administrator';

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

// Harry Potter School Selection Mod Begin
$lang['schoolselection1'] = "School:";
$lang['schoolselection2'] = "Congratulations! You have been sorted into ";
$lang['schoolselection3'] = "School";
$lang['school1name'] = "Beauxbatons";
$lang['school2name'] = "Durmstrang";
$lang['school3name'] = "Hogwarts";
// Harry Potter School Selection Mod End

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

            <td><strong><font color="<?php echo $cattext?>"><?php echo $lang['textcusstatus']?></font></strong></td>
    
===============
Add Code Below:
===============

            <!-- Harry Potter Random School Selection Mod Begin -->
            <td><strong><font color="<?php echo $THEME[cattext]?>"><?php echo $lang['schoolselection3']?></font></strong></td>
            <!-- Harry Potter Random School Selection Mod End -->
    
==========
Find Code:
==========

            $noban = $u2uban = $postban = $bothban = '';
            
===============
Add Code Below:
===============

            // Harry Potter Random School Selection Mod Begin
            $school1sel = $school2sel = $school3sel = '';
            // Harry Potter Random School Selection Mod End
            
==========
Find Code:
==========

                switch($member['status']) {
                    case 'Super Administrator':
                        $sadminselect = $selHTML;
                        break;
                    case 'Administrator':
                        $adminselect = $selHTML;
                        break;
                    case 'Super Moderator':
                        $smodselect = $selHTML;
                        break;
                    case 'Moderator':
                        $modselect = $selHTML;
                        break;
                    case 'Member':
                        $memselect = $selHTML;
                        break;
                    case 'Banned':
                        $banselect = $selHTML;
                        break;
                    default:
                        $memselect = $selHTML;
                        break;
                }
                
===============
Add Code Below:
===============

                // Harry Potter Random School Selection Mod Begin
                switch($member['school']) {
                    case 1:
                        $school1sel = $selHTML;
                        break;
                        
                    case 2:
                        $school2sel = $selHTML;
                        break;
                        
                    case 3:
                        $school3sel = $selHTML;
                        break;
                 }
                 // Harry Potter Random School Selection Mod End
               
==========
Find Code:
==========

                <td><input type="text" size="16" name="cusstatus<?php echo $member['uid']?>" value="<?php echo htmlspecialchars(stripslashes($member['customstatus']))?>" /></td>
                
===============
Add Code Below:
===============

                <!-- Harry Potter Random School Selection Mod Begin -->
                <td><select name="school<?php echo $member['uid']?>">
                <option value="1" <?php echo $school1sel?>><?php echo $lang['school1name']?></option>
                <option value="2" <?php echo $school2sel?>><?php echo $lang['school2name']?></option>
                <option value="3" <?php echo $school3sel?>><?php echo $lang['school3name']?></option>
                </select></td>
                <!-- Harry Potter Random School Selection Mod End -->
                
==========
Find Code:
==========

                $noban = $u2uban = $postban = $bothban = '';

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

                // Harry Potter Random School Selection Mod Begin
                $school1sel = $school2sel = $school3sel = '';
                // Harry Potter Random School Selection Mod End
                
==========
Find Code:
==========

            <td bgcolor="<?php echo $altbg2?>" class="ctrtablerow" colspan="7"><input type="submit" class="submit" name="membersubmit" value="<?php echo $lang['textsubmitchanges']?>" onclick="return confirmUserDel('<?php echo $lang['confirmDeleteUser']?>');" /><input type="hidden" name="srchmem" value="<?php echo $srchmem?>" /><input type="hidden" name="srchstatus" value="<?php echo $srchstatus?>" /></td>
            
================
Replace Code With:
================

            <td bgcolor="<?php echo $altbg2?>" class="ctrtablerow" colspan="8"><input type="submit" class="submit" name="membersubmit" value="<?php echo $lang['textsubmitchanges']?>" onclick="return confirmUserDel('<?php echo $lang['confirmDeleteUser']?>');" /><input type="hidden" name="srchmem" value="<?php echo $srchmem?>" /><input type="hidden" name="srchstatus" value="<?php echo $srchstatus?>" /></td>
            
==========
Find Code:
==========

            $delete = "delete".$mem['uid'];
            $delete = isset($_POST[$delete]) ? $_POST[$delete] : '';
            
===============
Add Code Below:
===============

            // Harry Potter Random School Selection Mod Begin
            $school = "school".$mem['uid'];
            $school = isset($_POST[$school]) ? $_POST[$school] : '';
            // Harry Potter Random School Selection Mod End
            
==========
Find Code:
==========

                    $db->query("UPDATE ".X_PREFIX."members SET ban='$banstatus'
    
================
Replace Code With:
================

                    $db->query("UPDATE ".X_PREFIX."members SET ban='$banstatus', school='$school'

=======================================================================================================
=======
Step 4:
=======
=================
Edit File: member.php
=================

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

            if ($SETTINGS['regoptional'] == 'off') {
        
===============
Add Code Above:
===============

            // Harry Potter School Selection Mod Begin
            $school = rand(1, 4);
            // Harry Potter School Selection Mod End

=================
Find Code (2 Times):
=================

        $db->query("INSERT INTO ".X_PREFIX."members (
        
==========================
Add To Line Before ') VALUES (' 
==========================

, school

=================================
Add Code To End Of Statement Before ')");':
=================================

, '$school'

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

"<center><span class=\"mediumtxt \">$lang[regged]</span></center>"

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

"<center><span class=\"mediumtxt \">$lang[regged]<br />$lang[schoolselection2]<strong>".$lang['school'.$school.'name']."</strong></span></center>"

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

                $emailblock = '';
                if ($memberinfo['showemail'] == 'yes') {
                    eval('$emailblock = "'.template('member_profile_email').'";');
                }
          
===============
Add Code Below:
===============

                // Harry Potter Random School Selection Mod Begin
                if ($memberinfo['school'] != 0) {
                    $school = 'school'.$memberinfo['school'].'name';
                    $memberinfo['school'] = $lang[$school];
                    $memberschool = "<img src=\"images/".$memberinfo['school'].".gif\" border=\"0\" /> ".$memberinfo['school'];
                } else {
                    $memberschool = $lang['textnone'];
                }
                // Harry Potter Random School Selection Mod End

=======================================================================================================
=======
Step 5:
=======
=================
Edit File: memcp.php
=================
==========
Find Code:
==========

    if ($member['mood'] != '') {
        $member['mood'] = censor($member['mood']);
        $member['mood'] = postify($member['mood'], 'no', 'no', 'yes', 'no', 'yes', 'no', true, 'yes');
    } else {
        $member['mood'] = '';
    }
    
==========
Add Below:
==========

    // Harry Potter Random School Selection Mod Begin
    $school = '';
    if ($member['school'] != 0) {
        $school = 'school'.$member['school'].'name';
        $school = $lang[$school];
    }
    // Harry Potter Random School Selection Mod End

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

            if ($post['location'] != '') {
                $post['location'] = censor($post['location']);
                $location = '<br />'.$lang['textlocation'].' '.$post['location'];
            } else {
                $location = '';
            }
            
===============
Add Code Below:
===============

            // Harry Potter Random School Selection Mod Begin
            $school = '';
            if ($post['school'] != 0) {
                $school = 'school'.$post['school'].'name';
                $post['school'] = $lang[$school];
                $school = "<br />".$lang['schoolselection1']." ".$post['school'];
            }
            // Harry Potter Random School Selection Mod End
            
==========
Find Code:
==========

            $location = '';
            $mood = '';
            
===============
Add Code Below:
===============

            // Harry Potter Random School Selection Mod Begin
            $school = '';
            // Harry Potter Random School Selection Mod End

=======================================================================================================
=======
Step 7:
=======
===============================
Go To Administration Panel --> Templates
===============================
=======================
Edit Template: member_profile
=======================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" valign="top">$lang[textstatus]<br /><a href="$sitelink" target="_blank">$memberinfo[avatar]</a></td>
<td bgcolor="$altbg2">$showtitle$customstatus<br />$stars<br /><br />$rank[avatarrank]</td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" valign="top" valign="top">$lang[schoolselection1]</td>
<td bgcolor="$THEME[altbg2]">$memberschool</td>
</tr>

=======================================================================================================
=======
Step 8:
=======
===============================
Go To Administration Panel --> Templates
===============================
======================
Edit Template: memcp_home
======================
==========
Find Code:
==========

<td bgcolor="$altbg1" valign="top">$lang[textcusstatus]</td>
<td bgcolor="$altbg2" valign="top">$member[customstatus]</td>
<td bgcolor="$altbg1" valign="top">&nbsp;</td>
<td bgcolor="$altbg2" valign="top">&nbsp;</td>
</tr>

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

<td bgcolor="$altbg1" valign="top">$lang[textcusstatus]</td>
<td bgcolor="$altbg2" valign="top">$member[customstatus]</td>
<td bgcolor="$THEME[altbg1]" valign="top">$lang[schoolselection1]</td>
<td bgcolor="$THEME[altbg2]" valign="top">$school</td>

=======================================================================================================
=======
Step 9:
=======
===============================
Go To Administration Panel --> Templates
===============================
========================
Edit Template: viewthread_post
========================
==========
Find Code:
==========

$location

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

$school

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