Modification Name: Facebook Link v1.0

Description:
This modification will offer a text area in registration and member profile to input a url to your facebook page.
This modification will display a button link to your facebook page in the members list and in your posts.
This modification will display a text link to your facebook page in your member profile.
This modification will offer the administrator the option to edit users facebook link.

Hack Author: WormHole

Supported Version: XMB 1.9.8 Engage SP3

Updated for 1.9.8 by: WormHole @ XMB Garage

Installation 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 package.

Author Note:
For security purposes, Please Check: http://www.xmbgarage.com for the latest version of this modification.
Downloading this modification from other sites could cause malicious code to enter into your XMB Forum software.
As such, XMB Garage.com will not offer support for modifications not offered at our web site.

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

Go to your admininstration panel and insert the code below into Insert Raw SQL

ALTER TABLE `$table_members` ADD `facebook` varchar(100) NOT NULL default '';

==============================================================================================================
===============
Edit editprofile.php
==============
======
Find:
======

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

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

    // Facebook Link Mod Begin
    $newfacebook = formVar('newfacebook');
    $facebook = $newfacebook ? checkInput($newfacebook, 'no', 'yes', 'javascript', false) : '';
    // Facebook Link Mod End

======
Find:
======

    $sig = addslashes($sig);

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

    // Facebook Link Mod Begin
    $facebook = addslashes($facebook);
    // Facebook Link Mod End

======
Find:
======

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

===========================================
Add to end of statement before WHERE username='$user'");
===========================================

, facebook='$newfacebook'

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

Edit member.php

======
Find:
======

loadtemplates(

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

loadtemplates(
'member_profile_facebook',

======
Find:
======

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

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

                // Facebook Link Mod Begin
                $facebook = postedVar('facebook', 'javascript', TRUE, TRUE, TRUE);
                // Facebook Link Mod End

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

) VALUES ('',

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

, facebook) VALUES ('',


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

)");

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

, '$facebook')");

======
Find:
======

                if ($memberinfo['site'] != 'http://') {
                    $site = $memberinfo['site'];
                } else {
                    $site = '';
                }

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

                // Facebook Link Mod Begin
                if (strpos($memberinfo['facebook'], 'http') === false) {
                    $memberinfo['facebook'] = "http://$memberinfo[facebook]";
                }

                // create facebook block
                $facebookblock = '';
                if ($memberinfo['facebook'] != 'http://') {
                    $facebook = $memberinfo['facebook'];
                    eval('$facebookblock = "'.template('member_profile_facebook').'";');
                }
                // Facebook Link Mod End

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

==============
Edit: memcp.php
==============
======
Find:
======

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

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

        // Facebook Link Mod Begin
        $newfacebook = formVar('newfacebook');
        $facebook = $newfacebook ? checkInput($newfacebook, 'no', 'yes', 'javascript', false) : '';
        // Facebook Link Mod End

======
Find:
======

        $sig = addslashes($sig);

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

        // Facebook Link Mod Begin
        $facebook = addslashes($facebook);
        // Facebook Link Mod End

======
Find:
======

 WHERE username='$xmbuser'");

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

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

==============================================================================================================
============
Edit: misc.php
============
======
Find:
======

loadtemplates(

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

loadtemplates(
'misc_mlist_row_facebook',

======
Find:
======

                if ($member['site'] == "http://") {
                    $site = '';
                } else {
                    eval('$site = "'.template('misc_mlist_row_site').'";');
                }

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

                // Facebook Link Mod Begin
                $member['facebook'] = str_replace($replace, '', $member['facebook']);
                $member['facebook'] = "http://$member[facebook]";

                if ($member['facebook'] == "http://") {
                    $facebook = "&nbsp;";
                } else {
                    eval('$facebook = "'.template('misc_mlist_row_facebook').'";');
                }
                // Facebook Link Mod End

==============================================================================================================
================
Edit: viewthread.php
================
======
Find:
======

loadtemplates(

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

loadtemplates(
'viewthread_post_facebook',

======
Find:
======

            // Facebook Link Mod Begin
            if ($post['site'] == '') {
                $site = '';
            } else {
                $post['site'] = str_replace("http://", "", $post['site']);
                $post['site'] = "http://$post[site]";
                eval('$site = "'.template('viewthread_post_site').'";');
            }
            // Facebook Link Mod End

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

            // Facebook Link Mod Begin
            if ($post['facebook'] == '') {
                $facebook ='';
            } else {
                $post['facebook'] = str_replace("http://", "", $post['facebook']);
                $post['facebook'] = "http://$post[facebook]";
                eval('$facebook = "'.template('viewthread_post_facebook').'";');
            }
            // Facebook Link Mod End

======
Find:
======

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

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

            // Facebook Link Mod Begin
            $facebook = '';
            // Facebook Link Mod End

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

// Facebook Link Mod Begin
$lang['textfacebook'] = "Facebook:";
$lang['altvisitfacebook'] = "Visit User's facebook Page";
// Facebook Link Mod End

==============================================================================================================
===========================
Edit Template: admintool_editprofile
===========================
======
Find:
======

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

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

==============================================================================================================
=======================
Edit Template: member_profile
=======================
======
Find:
======

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textsite]</td>
<td bgcolor="$altbg2"><a href="$site" target="_blank">$site</a></td>
</tr>

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

$facebookblock

==============================================================================================================
===========================
Edit Template: member_reg_optional
===========================
======
Find:
======

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

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

==============================================================================================================
=======================
Edit Template: memcp_profile
=======================
======
Find:
======

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

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

==============================================================================================================
===================================
Edit Templates: misc_mlist and misc_mlist_admin
===================================
=============
Find (2 Times):
=============

colspan="7"

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

colspan="8"

======
Find:
======

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

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

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

==============================================================================================================
=======================
Edit Template: misc_mlist_row
=======================
=====
Find:
=====

<td bgcolor="$altbg2" class="ctrtablerow">$member[status]</td>
<td bgcolor="$altbg1" class="ctrtablerow">$email</td>
<td bgcolor="$altbg2" class="ctrtablerow">$site</td>
<td bgcolor="$altbg1" class="tablerow">$member[location]</td>
<td bgcolor="$altbg2" class="ctrtablerow">$member[regdate]</td>
<td bgcolor="$altbg1" class="ctrtablerow">$member[postnum]</td>
<td bgcolor="$altbg2" class="ctrtablerow">$lastpost</td>
<td bgcolor="$altbg1" class="ctrtablerow">$member[lastvisit]</td>

===========
Replace With:
(There may be other hacks impacting this area. You will need to make proper adjustments accordingly)
===========

<td bgcolor="$altbg2" class="ctrtablerow">$member[status]</td>
<td bgcolor="$altbg1" class="ctrtablerow">$email</td>
<td bgcolor="$altbg2" class="ctrtablerow">$site</td>
<td bgcolor="$THEME[altbg1]" class="ctrtablerow">$facebook</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>
<td bgcolor="$altbg1" class="ctrtablerow">$lastpost</td>
<td bgcolor="$altbg2" class="ctrtablerow">$member[lastvisit]</td>

==============================================================================================================
==============================================================
Edit Templates: misc_mlist_multipage, misc_mlist_results_none and misc_mlist_separator
==============================================================
=====
Find:
=====

colspan="7"

===========
Replace with:
===========

colspan="8"

==============================================================================================================
========================
Edit Template: viewthread_post
========================
=====
Find:
=====

$yahoo

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

$facebook

==============================================================================================================
================================
Create Template: member_profile_facebook
================================

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[textfacebook]</td>
<td bgcolor="$THEME[altbg2]"><a href="$facebook" target="_blank">$facebook</td>
</tr>

==============================================================================================================
================================
Create Template: misc_mlist_row_facebook
================================

<a href="$member[facebook]" target="_blank"><img src="$THEME[imgdir]/facebook.gif" border="0" alt="$lang[altvisitfacebook]" /></a>

==============================================================================================================
=================================
Create Template: viewthread_post_facebook
=================================

<a href="$post[facebook]" target="_blank"><img src="$THEME[imgdir]/facebook.gif" border="0" alt="$lang[altvisitfacebook]" /></a>

==============================================================================================================
==================================
Upload image facebook.gif to all theme folders.
==================================
Enjoy!

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