Title: Real Name And Aka v2.0

Author: John Briggs

Description:
This modification will provide an additional field where members can show their real name in profiles.
This modification will provide an additional field where members can show their real name in the member list.
This modification will provide an additional field where members can show their real name in threads/profiles with an on/off option.

Copyright:  2009 John Briggs. All rights reserved.

Compatability: XMB 1.9.11

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.

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

===================================================================
Go To Admin Panel -> Insert Raw SQL & click "Submit Changes" button
===================================================================

ALTER TABLE `$table_members` ADD `realname` varchar(25) NOT NULL default '';
ALTER TABLE `$table_members` ADD `showname` set('yes','no') NOT NULL default 'no';

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

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

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

loadtemplates(

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

'member_profile_realname',

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

            $useoldu2u = formYesNo('useoldu2u');

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

            // Real Name Mod Begin
            $showname = formYesNo('showname');
            // Real Name Mod End

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

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

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

                // Real Name Mod Begin
                $realname = postedVar('realname', 'javascript', TRUE, TRUE, TRUE);
                // Real Name Mod End

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

) VALUES ('$username'

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

, realname, showname) VALUES ('$username'

====================================================
Find Code At End Of Above Query Statement (2 Times):
====================================================

)");

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

, '$realname', '$showname')");

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

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

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

        // Real Name Mod Begin
        $nameblock = '';
        if ($memberinfo['realname'] != '' && $memberinfo['showname'] == 'yes') {
            $memberinfo['realname'] = censor($memberinfo['realname']);
            eval('$nameblock = "'.template('member_profile_realname').'";');
        }
        // Real Name Mod End

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

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

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

        $invchecked = '';
        if ($member['invisible'] == 1) {
            $invchecked = $cheHTML;
        }

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

        // Real Name Mod Begin
        $shownamechecked = '';
        if ($member['showname'] == 'yes') {
            $shownamechecked = $cheHTML;
        }
        // Real Name Mod End

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

        $newsletter = formYesNo('newnewsletter');

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

        // Real Name Mod Begin
        $showname = formYesNo('showname');
        // Real Name Mod End

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

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

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

        // Real Name Mod Begin
        $realname = postedVar('realname', 'javascript', TRUE, TRUE, TRUE);
        // Real Name 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:
==================

, realname='$realname', showname='$showname' WHERE username='$xmbuser'");

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

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

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

    $invchecked = '';
    if ($member['invisible'] == 1) {
        $invchecked = $cheHTML;
    }

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

    // Real Name Mod Begin
    $shownamechecked = '';
    if ($member['showname'] == 'yes') {
        $shownamechecked = $cheHTML;
    }
    // Real Name Mod End

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

    $newsletter = formYesNo('newnewsletter');

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

    // Real Name Mod Begin
    $showname = formYesNo('showname');
    // Real Name Mod End

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

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

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

    // Real Name Mod Begin
    $realname = postedVar('realname', 'javascript', TRUE, TRUE, TRUE);
    // Real Name 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:
==================

, realname='$realname', showname='$showname' WHERE username='$user'");

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

===================
Edit File: misc.php
===================

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

                if (X_MEMBER && $member['email'] != '' && $member['showemail'] == 'yes') {
                    eval('$email = "'.template('misc_mlist_row_email').'";');
                } else {
                    $email = '';
                }

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

                // Real Name Mod Begin
                if ($member['realname'] != '' And $member['showname'] == 'yes') {
                    $member['realname'] = censor($member['realname']);
                } else {
                    $member['realname'] = '';
                }
                // Real Name 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:
===============

            // Real Name Mod Begin
            $realname = '';
            if ($post['realname'] != '' && $post['showname'] == 'yes') {
                $post['realname'] = censor($post['realname']);
                $realname = '<br /><strong>'.$lang['aka'].'</strong> '.$post['realname'];
            }
            // Real Name Mod End

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

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

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

            // Real Name Mod Begin
            $realname = '';
            // Real Name Mod End

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

=====================
Edit File: header.php
=====================

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

/* Set Up HTML Templates and Themes */

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

// Real Name Mod Begin
// Assert Real Name Translation
if (!isset($lang['realname'])) {
    require_once(ROOT.'include/translation.inc.php');
    $phrases = array();
    $phrases['realname'] = "Real Name:";
    $phrases['showname'] = "Show real name in threads, profiles &amp; member list?";
    $phrases['aka'] = "a.k.a.:";
    setManyLangValues($phrases, $langfile);
    loadLang($langfile);
}
// Real Name Mod End

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

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

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

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

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

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

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

<input type="checkbox" name="newshowemail" value="yes" $checked /> $lang[textshowemail]<br />

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

<input type="checkbox" name="showname" value="yes" $shownamechecked /> $lang[showname]<br />

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

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

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

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

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

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

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

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

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

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textshowemail]</td>
<td bgcolor="$altbg2"><input type="checkbox" name="showemail" value="yes" /></td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[showname]</td>
<td bgcolor="$THEME[altbg2]"><input type="checkbox" name="showname" value="yes" /></td>
</tr>

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

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

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

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

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

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

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

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textshowemail]</td>
<td bgcolor="$altbg2"><input type="checkbox" name="newshowemail" value="yes" $checked /> </td>
</tr>

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

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[showname]</td>
<td bgcolor="$THEME[altbg2]"><input type="checkbox" name="showname" value="yes" $shownamechecked /></td>
</tr>

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

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

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

colspan="7"

=======================
Replace Code (2 Times):
=======================

td colspan="8"

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


<td width="10%">$lang[textemail]:</td>

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

<td width="10%">$lang[realname]</td>

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

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

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

colspan="7"

=======================
Replace Code (2 Times):
=======================

colspan="8"

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

<td width="10%">$lang[textemail]:</td>

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

<td width="10%">$lang[realname]</td>

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

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

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

<tr>
<td bgcolor="$altbg1" class="tablerow"><a href="member.php?action=viewpro&amp;member=$memurl">$member[username]</a></td>
<td bgcolor="$altbg2" class="ctrtablerow">$member[status]</td>
<td bgcolor="$altbg1" class="ctrtablerow">$member[realname]</td>
<td bgcolor="$altbg2" class="ctrtablerow">$email</td>
<td bgcolor="$altbg1" class="ctrtablerow">$site</td>
<td bgcolor="$altbg2" class="tablerow">$member[location]</td>
<td bgcolor="$altbg1" class="ctrtablerow">$member[regdate]</td>
<td bgcolor="$altbg2" class="ctrtablerow">$member[postnum]</td>
</tr>

=======================================================================================================================================
========
Step 15:
========

====================================================================================================
Go To Admin Panel-> Templates -> misc_mlist_multipage, misc_mlist_results_none, misc_mlist_separator
====================================================================================================

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

colspan="7"

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

colspan="8"

=======================================================================================================================================
========
Step 16:
========

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

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

<font class="mediumtxt"><strong>$profilelink</strong></font>

===============
Add Code After:
===============

$realname

=======================================================================================================================================
========
Step 17:
========

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

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

<tr class="tablerow">
<td bgcolor="$altbg1">$lang[textregistered]</td>
<td bgcolor="$altbg2">$memberinfo[regdate] ($ppd $lang[textmesperday])</td>
</tr>

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

$nameblock

=======================================================================================================================================
========
Step 18:
========

=================================================================================
Go To Admin Panel -> Templates -> Create Template Name -> member_profile_realname
=================================================================================

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

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[realname]</td>
<td bgcolor="$THEME[altbg2]">$memberinfo[realname]</td>
</tr>

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