Title: RPG Character Selection v1.0

Author: John Briggs

Description:
This mod will provide an option to select a RPG character image in your member control panel.
This mod will display your selected RPG character image in your profile, control panel and threads.

Copyright:  2006 John Briggs. All rights reserved.

Compatability: XMB 1.9.5 Final

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

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

Author Note:
You downloaded this hack from XMBMods.com, the #1 source for XMB related downloads.
Please visit http://www.xmbmods.com/ for support.

=======================================================================================================================================================
=======
Step 1:
=======

===================================
Go To Admin Panel -> Insert Raw SQL
===================================

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

=======================================================================================================================================
=======
Step 2:
=======

=====================
Edit File: member.php
=====================

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

loadtemplates(

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

loadtemplates('member_profile_rpgchar',

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

            $lfs = array();
            $dir = opendir(ROOT.'/lang/');
            while($file = readdir($dir)) {
                if (is_file(ROOT.'/lang/'.$file) && false !== strpos($file, '.lang.php')) {
                    $file = str_replace('.lang.php', '', $file);
                    if ($file == $SETTINGS['langfile']) {
                        $lfs[] = '<option value="' .$file. '" selected="selected">'.$file.'</option>';
                    } else {
                        $lfs[] = '<option value="' .$file. '">'.$file.'</option>';
                    }
                }
            }
            natcasesort($lfs);
            $langfileselect = '<select name="newlangfile">'.implode("\n", $lfs).'</select>';

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

            $rpgs = array();
            $rpgs[] = '<option value="">'.$lang['rpgcharnone'].'</option>';
            $dp = opendir(ROOT.'images/rpgchar');
            while ($file = readdir($dp)) {
                if ($file != '.' AND $file != '..' AND $file != 'index.html') {
                    $rpgcharname = $file;
                    $rpgcharname = str_replace('.gif', '', $rpgcharname);
                    $rpgcharname = str_replace('_', ' ', $rpgcharname);
                    $rpgs[] = '<option value="'.$file.'">'.$rpgcharname.'</option>';
                }
            }
            closedir($dp);
            natcasesort($rpgs);
            $rpgcharselect = '<select name="rpgchar">'.implode("\n", $rpgs).'</select>';

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

        $sig           = checkInput($_POST['sig']);

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

        $rpgchar     = isset($rpgchar) ? checkInput($rpgchar, '', '', 'javascript', false) : '';

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

        $locationnew    = addslashes($locationnew);

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

        $rpgchar         = addslashes($rpgchar);

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

        $db->query("INSERT INTO $table_members (uid,

=====================================
Find Code In-Line In Above Statement:
=====================================

) VALUES ('', '$username',

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

, rpgchar) VALUES ('', '$username',

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

)");

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

, '$rpgchar')");

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

            if ($memberinfo['customstatus'] != '') {
                $showtitle = $rank['title'];
                $customstatus = '<br />'.$memberinfo['customstatus'];
            } else {
                $showtitle = $rank['title'];
                $customstatus = '';
            }

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

            $rpgcharblock = '';
            if ($memberinfo['rpgchar'] != '') {
                $rpgcharname = $memberinfo['rpgchar'];
                $rpgcharname = str_replace('.gif', '', $rpgcharname);
                $rpgcharname = str_replace('_', ' ', $rpgcharname);
                if (file_exists(ROOT.'images/rpgchar/'.$memberinfo['rpgchar'])) {
                    $rpgcharimg = '<img src="./images/rpgchar/'.$memberinfo['rpgchar'].'" alt="'.$rpgcharname.'" title="'.$rpgcharname.'" border="0" />';
                    $memberinfo['rpgchar'] = $rpgcharimg;
                    eval('$rpgcharblock = "'.template('member_profile_rpgchar').'";');
                }
            }

=======================================================================================================================================
=======
Step 3:
=======

====================
Edit File: memcp.php
====================

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

        $lfs = array();
        $dir = opendir(ROOT.'/lang/');
        while($file = readdir($dir)) {
            if (is_file(ROOT.'/lang/'.$file) && false !== strpos($file, '.lang.php')) {
                $file = str_replace('.lang.php', '', $file);
                if ($file == $member['langfile']) {
                    $lfs[] = '<option value="' .$file. '" selected="selected">'.$file.'</option>';
                } else {
                    $lfs[] = '<option value="' .$file. '">'.$file.'</option>';
                }
            }
        }
        natcasesort($lfs);
        $langfileselect = '<select name="langfilenew">'.implode("\n", $lfs).'</select>';

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

        $rpgs = array();
        $rpgs[] = '<option value="">'.$lang['rpgcharnone'].'</option>';
        $dp = opendir(ROOT.'images/rpgchar');
        while ($file = readdir($dp)) {
            if ($file != '.' AND $file != '..' AND $file != 'index.html') {
                $rpgcharname = $file;
                $rpgcharname = str_replace('.gif', '', $rpgcharname);
                $rpgcharname = str_replace('_', ' ', $rpgcharname);
                if ($member['rpgchar'] == $file) {
                    $rpgs[] = '<option value="'.$file.'" selected="selected">'.$rpgcharname.'</option>';
                } else {
                    $rpgs[] = '<option value="'.$file.'">'.$rpgcharname.'</option>';
                }
            }
        }
        closedir($dp);
        natcasesort($rpgs);
        $rpgcharselect = '<select name="rpgchar">'.implode("\n", $rpgs).'</select>';

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

        $sig            = isset($newsig) ? checkInput($newsig, '', $SETTINGS['sightml'], '', false) : '';

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

        $rpgchar        = isset($rpgchar) ? checkInput($rpgchar, '', '', 'javascript', false) : '';

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

        $memlocation    = addslashes($memlocation);

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

        $rpgchar         = addslashes($rpgchar);

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

$db->query("UPDATE $table_members SET $pwtxt email='$email',

==================================================
Find Code In-Line At End Of Above Query Statement:
==================================================

 WHERE username='$xmbuser'");

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

, rpgchar='$rpgchar' WHERE username='$xmbuser'");

==========
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'] = '&nbsp;';
    }

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

    if ($member['rpgchar'] != '') {
        $rpgcharname = $member['rpgchar'];
        $rpgcharname = str_replace('.gif', '', $rpgcharname);
        $rpgcharname = str_replace('_', ' ', $rpgcharname);
        if (file_exists(ROOT.'images/rpgchar/'.$member['rpgchar'])) {
            $rpgcharimg = '<img src="./images/rpgchar/'.$member['rpgchar'].'" alt="'.$rpgcharname.'" title="'.$rpgcharname.'" border="0" />';
            $member['rpgchar'] = $rpgcharimg;
        }
    }

=======================================================================================================================================
=======
Step 4:
=======

==========================
Edit File: editprofile.php
==========================

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

    $langfileselect = "<select name=\"langfilenew\">\n";
    $dir = opendir("lang");
    while ( $thafile = readdir($dir) )
    {
        if ( is_file("lang/$thafile") && false !== strpos($thafile, '.lang.php') )
        {
            $thafile = str_replace(".lang.php", "", $thafile);
            if ( $thafile == $member['langfile'] )
            {
                $langfileselect .= "<option value=\"" .$thafile. "\" selected=\"selected\">" .$thafile. "</option>\n";
            }
            else
            {
                $langfileselect .= "<option value=\"" .$thafile. "\">" .$thafile. "</option>\n";
            }
        }
    }
    $langfileselect .= "</select>";

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

    $rpgs = array();
    $rpgs[] = '<option value="">'.$lang['rpgcharnone'].'</option>';
    $dp = opendir(ROOT.'images/rpgchar');
    while ($file = readdir($dp)) {
        if ($file != '.' AND $file != '..' AND $file != 'index.html') {
            $rpgcharname = $file;
            $rpgcharname = str_replace('.gif', '', $rpgcharname);
            $rpgcharname = str_replace('_', ' ', $rpgcharname);
            if ($member['rpgchar'] == $file) {
                $rpgs[] = '<option value="'.$file.'" selected="selected">'.$rpgcharname.'</option>';
            } else {
                $rpgs[] = '<option value="'.$file.'">'.$rpgcharname.'</option>';
            }
        }
    }
    closedir($dp);
    natcasesort($rpgs);
    $rpgcharselect = '<select name="rpgchar">'.implode("\n", $rpgs).'</select>';

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

    $sig            = isset($newsig) ? checkInput($newsig, '', $SETTINGS['sightml'], '', false) : '';

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

    $rpgchar        = isset($rpgchar) ? checkInput($rpgchar, '', '', 'javascript', false) : '';

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

    $memlocation    = addslashes($newmemlocation);

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

    $rpgchar         = addslashes($rpgchar);

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

$db->query("UPDATE $table_members SET email='$email',

==================================================
Find Code In-Line At End Of Above Query Statement:
==================================================

 WHERE username='$user'");

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

, rpgchar='$rpgchar' WHERE username='$user'");

=======================================================================================================================================
=======
Step 5:
=======

=========================
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:
===============

            if ($post['rpgchar'] != '') {
                $rpgcharname = $post['rpgchar'];
                $rpgcharname = str_replace('.gif', '', $rpgcharname);
                $rpgcharname = str_replace('_', ' ', $rpgcharname);
                if (file_exists(ROOT.'images/rpgchar/'.$post['rpgchar'].'')) {
                    $rpgcharimg = '<img src="./images/rpgchar/'.$post['rpgchar'].'" alt="'.$rpgcharname.'" title="'.$rpgcharname.'" border="0" />';
                    $post['rpgchar'] = '<br />'.$lang['rpgchar'].' '.$rpgcharimg;
                }
            }

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

            $location = '';
            $mood = '';

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

            $post['rpgchar'] = '';

=======================================================================================================================================
=======
Step 6:
=======

=================================
Edit File: lang/English.lang.php
=================================

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

$lang['xmbgroup'] = "The XMB Group";

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

// RPG Character Selection Mod Begin
$lang['rpgchar'] = "RPG Character:";
$lang['rpgcharnone'] = "--Select RPG Character--";
// RPG Character Selection Mod End

=======================================================================================================================================
=======
Step 7:
=======

=======================================================
Go To Admin Panel -> Templates -> admintool_editprofile
=======================================================

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

<tr>
<td bgcolor="$altbg1" width="22%" class="tablerow">$lang[textlocation]</td>
<td bgcolor="$altbg2" class="tablerow"><input type="text" name="newmemlocation" size="25" value="$member[location]" /></td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[rpgchar]</td>
<td bgcolor="$altbg2">$rpgcharselect</td>
</tr>

=======================================================================================================================================
=======
Step 8:
=======

============================================
Go To Admin Panel -> Templates -> member_reg
============================================

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

<tr>
<td bgcolor="$altbg1" class="tablerow" width="22%">$lang[textlocation]</td>
<td bgcolor="$altbg2" class="tablerow"><input type="text" name="locationnew" size="25" /></td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[rpgchar]</td>
<td bgcolor="$altbg2">$rpgcharselect</td>
</tr>

=======================================================================================================================================
=======
Step 9:
=======

===============================================
Go To Admin Panel -> Templates -> memcp_profile
===============================================

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

<tr>
<td bgcolor="$altbg1" width="22%" class="tablerow">$lang[textlocation]</td>
<td bgcolor="$altbg2" class="tablerow"><input type="text" name="newmemlocation" size="25" value="$member[location]" /></td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[rpgchar]</td>
<td bgcolor="$altbg2">$rpgcharselect</td>
</tr>

=======================================================================================================================================
========
Step 10:
========

=================================================
Go To Admin Panel -> Templates -> viewthread_post
=================================================

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

$location

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

$post[rpgchar]

=======================================================================================================================================
========
Step 11:
========

================================================
Go To Admin Panel -> Templates -> member_profile
================================================

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

<tr>
<td bgcolor="$altbg1" class="tablerow">$lang[textlocation]</td>
<td bgcolor="$altbg2" class="tablerow">$memberinfo[location]</td>
</tr>

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

$rpgcharblock

=======================================================================================================================================
========
Step 12:
========

================================================================================
Go to admin panel -> templates -> create template name -> member_profile_rpgchar
================================================================================

================================
Add Code & Click Submit Changes:
================================

<tr class="tablerow">
<td bgcolor="$altbg1" widht="22%" valign="top">$lang[rpgchar]</td>
<td bgcolor="$altbg2">$memberinfo[rpgchar]</td>
</tr>

=======================================================================================================================================
========
Step 13:
========

============================================
Go To Admin Panel -> Templates -> memcp_home
============================================

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

<td bgcolor="$altbg1" valign="top">&nbsp;</td>
<td bgcolor="$altbg2" valign="top">&nbsp;</td>

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

<td bgcolor="$altbg1" valign="top">$lang[rpgchar]</td>
<td bgcolor="$altbg2" valign="top" align="center">$member[rpgchar]</td>

=======================================================================================================================================
========
Step 14:
========

Now upload provided folder named "/rpgchar/" to your forum "/images/" directory.

=======================================================================================================================================