Title: Marital Status Selection v2.0

Author: John Briggs

Description:
This modification will provide an option to select a Marital Status image in your member control panel.
This modification will display your selected Marital Status image in your profile, control panel and threads.

Copyright:  2006 John Briggs. All rights reserved.

Compatability: XMB 1.9.8 SP3

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

Author Note:
You downloaded this hack from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.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_marital',

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

                $langfileselect = createLangFileSelect($SETTINGS['langfile']);

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

                // Marital Status Selection Mod Begin
                $mss = array();
                $mss[] = '<option value="">'.$lang['maritalnone'].'</option>';
                $dp = opendir(ROOT.'images/marital');
                while ($file = readdir($dp)) {
                    if ($file != '.' AND $file != '..' AND $file != 'index.html') {
                        $maritalname = $file;
                        $maritalname = str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $maritalname);
                        if ($memberinfo['marital'] == $file) {
                            $mss[] = '<option value="'.$file.'" selected="selected">'.$maritalname.'</option>';
                        } else {
                            $mss[] = '<option value="'.$file.'">'.$maritalname.'</option>';
                        }
                    }
                }
                closedir($dp);
                natcasesort($mss);
                $maritalselect = '<select name="marital" onchange="document.getElementById(\'maritalimg\').src = (this.options[this.selectedIndex].value != \'\') ? \'images/marital/\'+this.options[this.selectedIndex].value : \'./images/pixel.gif\';" />'.implode("\n", $mss).'</select>';
                $maritalimg  = '<img src="'.ROOT.'images/pixel.gif" id="maritalimg" alt="" />';
                if ($memberinfo['marital'] != '') {
                    $maritalimg = '<img src="'.ROOT.'images/marital/'.$memberinfo['marital'].'" alt="'.str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $memberinfo['marital']).'" id="maritalimg" />';
                }
                // Marital Status Selection Mod End

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

                $sig = postedVar('sig', 'javascript', ($SETTINGS['sightml']=='off'), TRUE, TRUE);

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

                // Marital Status Selection Mod Begin
                $marital = postedVar('marital', 'javascript', TRUE, TRUE, TRUE);
                // Marital Status Selection Mod End

===================
Find Code (2 instances):
===================

) VALUES ('$username',

=========================
Replace Code With (2 instances):
=========================

, marital) VALUES ('$username',

=================================
Find Code At End Of Both Query Statements:
=================================

)");

===========================
Replace Code With (Both Instances):
===========================

, '$marital')");

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

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

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

                // Marital Status Selection Mod Begin
                $maritalblock = '';
                if ($memberinfo['marital'] != '') {
                    $maritalname = $memberinfo['marital'];
                    $maritalname = str_replace('.gif', '', $maritalname);
                    $maritalname = str_replace('_', ' ', $maritalname);
                    if (file_exists(ROOT.'images/marital/'.$memberinfo['marital'])) {
                        $maritalimg = '<img src="./images/marital/'.$memberinfo['marital'].'" alt="'.$maritalname.'" title="'.$maritalname.'" border="0" /><br />'.$maritalname;
                        $memberinfo['marital'] = $maritalimg;
                        eval('$maritalblock = "'.template('member_profile_marital').'";');
                    }
                }
                // Marital Status Selection Mod End

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

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

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

        $langfileselect = createLangFileSelect($member['langfile']);

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

        // Marital Status Selection Mod Begin
        $mss = array();
        $mss[] = '<option value="">'.$lang['maritalnone'].'</option>';
        $dp = opendir(ROOT.'images/marital');
        while ($file = readdir($dp)) {
            if ($file != '.' AND $file != '..' AND $file != 'index.html') {
                $maritalname = $file;
                $maritalname = str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $maritalname);
                if ($member['marital'] == $file) {
                    $mss[] = '<option value="'.$file.'" selected="selected">'.$maritalname.'</option>';
                } else {
                    $mss[] = '<option value="'.$file.'">'.$maritalname.'</option>';
                }
            }
        }
        closedir($dp);
        natcasesort($mss);
        $maritalselect = '<select name="newmarital" onchange="document.getElementById(\'maritalimg\').src = (this.options[this.selectedIndex].value != \'\') ? \'images/marital/\'+this.options[this.selectedIndex].value : \'./images/pixel.gif\';" />'.implode("\n", $mss).'</select>';
        $maritalimg  = '<img src="'.ROOT.'images/pixel.gif" id="maritalimg" alt="" />';
        if ($member['marital'] != '') {
            $maritalimg = '<img src="'.ROOT.'images/marital/'.$member['marital'].'" alt="'.str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $member['marital']).'" id="maritalimg" />';
        }
        // Marital Status Selection Mod End

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

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

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

        // Marital Status Selection Mod Begin
        $newmarital = formVar('newmarital');
        $marital = $newmarital ? checkInput($newmarital, 'no', 'yes', 'javascript', false) : '';
        // Marital Status Selection Mod End

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

        $sig = addslashes($sig);

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

        // Marital Status Selection Mod Begin
        $marital = addslashes($marital);
        // Marital Status Selection Mod End

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

$db->query("UPDATE ".X_PREFIX."members SET $pwtxt

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

 WHERE username='$xmbuser'");

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

, marital='$newmarital' 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'] = '';
    }

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

    // Marital Status Selection Mod Begin
    if ($member['marital'] != '') {
        $maritalname = $member['marital'];
        $maritalname = str_replace('.gif', '', $maritalname);
        $maritalname = str_replace('_', ' ', $maritalname);
        if (file_exists(ROOT.'images/marital/'.$member['marital'])) {
            $maritalimg = '<img src="'.ROOT.'images/marital/'.$member['marital'].'" alt="'.$maritalname.'" title="'.$maritalname.'" border="0" /><br />'.$maritalname;
            $member['marital'] = $maritalimg;
        }
    }
    // Marital Status Selection Mod End

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

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

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

    $langfileselect = createLangFileSelect($member['langfile']);

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

    // Marital Status Selection Mod Begin
    $mss = array();
    $mss[] = '<option value="">'.$lang['maritalnone'].'</option>';
    $dp = opendir(ROOT.'images/marital');
    while ($file = readdir($dp)) {
        if ($file != '.' AND $file != '..' AND $file != 'index.html') {
            $maritalname = $file;
            $maritalname = str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $maritalname);
            if ($member['marital'] == $file) {
                $mss[] = '<option value="'.$file.'" selected="selected">'.$maritalname.'</option>';
            } else {
                    $mss[] = '<option value="'.$file.'">'.$maritalname.'</option>';
            }
        }
    }
    closedir($dp);
    natcasesort($mss);
    $maritalselect = '<select name="newmarital" onchange="document.getElementById(\'maritalimg\').src = (this.options[this.selectedIndex].value != \'\') ? \'images/marital/\'+this.options[this.selectedIndex].value : \'./images/pixel.gif\';" />'.implode("\n", $mss).'</select>';
    $maritalimg  = '<img src="'.ROOT.'images/pixel.gif" id="maritalimg" alt="" />';
    if ($member['marital'] != '') {
        $maritalimg = '<img src="'.ROOT.'images/marital/'.$member['marital'].'" alt="'.str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $member['marital']).'" id="maritalimg" />';
    }
    // Marital Status Selection Mod End

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

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

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

    // Marital Status Selection Mod Begin
    $newmarital = formVar('newmarital');
    $marital = $newmarital ? checkInput($newmarital, 'no', 'yes', 'javascript', false) : '';
    // Marital Status Selection Mod End

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

    $sig = addslashes($sig);

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

    // Marital Status Selection Mod Begin
    $marital = addslashes($marital);
    // Marital Status Selection Mod End

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

$db->query("UPDATE ".X_PREFIX."members SET email='$email',

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

 WHERE username='$user'");

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

, marital='$marital' 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:
===============

            // Marital Status Selection Mod Begin
            if ($post['marital'] != '') {
                $maritalname = $post['marital'];
                $maritalname = str_replace(array('.gif','.jpg','.png','_'), array('','','',' '), $maritalname);
                if (file_exists(ROOT.'images/marital/'.$post['marital'].'')) {
                    $maritalimg = '<img src="'.ROOT.'images/marital/'.$post['marital'].'" alt="'.$maritalname.'" title="'.$maritalname.'" border="0" /><br />'.$maritalname.'<br />';
                    $post['marital'] = '<br />'.$lang['marital'].' '.$maritalimg;
                }
            }
            // Marital Status Selection Mod End

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

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

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

            // Marital Status Selection Mod Begin
            $post['marital'] = '';
            // Marital Status Selection Mod End

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

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

====================
Add Code To End Of File:
====================

// Marital Status Selection Mod Begin
$lang['marital'] = "Marital Status:";
$lang['maritalnone'] = "--Select Marital Status--";
// Marital Status Selection Mod End

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

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

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

$dayselect
<input type="text" name="year" size="4" value="$year" />
</td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[marital]</td>
<td bgcolor="$THEME[altbg2]">$maritalselect&nbsp;<img id="maritalimg" src="./images/marital/$member[marital]" alt="$maritalname" title="$maritalname" border="0" /></td>
</tr>

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

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

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

$dayselect
<input type="text" name="year" size="4" />
</td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[marital]</td>
<td bgcolor="$THEME[altbg2]">$maritalselect&nbsp;<img id="maritalimg" src="./images/pixel.gif" alt="$maritalname" title="$maritalname" border="0" /></td>
</tr>

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

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

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

$dayselect
<input type="text" name="year" size="4" value="$year" /></td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[marital]</td>
<td bgcolor="$THEME[altbg2]">$maritalselect&nbsp;$maritalimg</td>
</tr>

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

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

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

$location

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

$post[marital]

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

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

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

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

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

$maritalblock

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

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

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

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%" valign="top">$lang[marital]</td>
<td bgcolor="$THEME[altbg2]">$memberinfo[marital]</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="$THEME[altbg1]" valign="top">$lang[marital]</td>
<td bgcolor="$THEME[altbg2]" valign="top" align="center">$member[marital]</td>

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

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

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