============================================================================================================================
Modification Name: Facebook Link

Version: 1.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.

Author: WormHole

Supported Version: XMB 1.9.5 SP1

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 v3. 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 in our modifications list.
============================================================================================================================
=======
Step 1:
=======
====================================
Go To Admininstration Panel --> Insert Raw SQL
====================================
========================
Add Code and Submit Changes
========================

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

============================================================================================================================
=======
Step 2:
=======
===================
Edit File: editprofile.php
===================
==========
Find Code:
==========

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

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

    // Facebook Link Mod Begin
    $facebook = isset($facebook) ? checkInput($facebook, '', '', 'javascript', false) : '';
    // Facebook Link Mod End

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

    $sig            = addslashes($sig);

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

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

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

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

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

 WHERE username='$user'");

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

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

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

loadtemplates(

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

loadtemplates(
'member_profile_facebook',

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

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

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

        // Facebook Link Mod Begin
        $facebook = isset($facebook) ? checkInput($facebook, '', '', "javascript", false) : '';
        // Facebook Link Mod End

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

        $sig           = addslashes($sig);

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

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

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

) VALUES ('',

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

, facebook) VALUES ('',

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

)");

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

, '$facebook')");

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

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

===============
Add Code 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

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

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

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

        // Facebook Link Mod Begin
        $facebook = isset($facebook) ? checkInput($facebook, '', '', 'javascript', false) : '';
        // Facebook Link Mod End

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

        $sig            = addslashes($sig);

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

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

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

$db->query("UPDATE $table_members SET $pwtxt

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

 WHERE username='$xmbuser'");

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

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

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

loadtemplates(

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

loadtemplates(
'viewthread_post_facebook',

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

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

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

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

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

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

============================================================================================================================
=======
Step 6:
=======
=======================
Edit File: lang/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

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

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

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

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

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

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

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

$facebookblock

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

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

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

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

============================================================================================================================
========
Step 10:
========
===============================
Go To Administration Panel --> Templates
===============================
=======================
Edit Template: memcp_profile
=======================
==========
Find Code:
==========

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

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

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

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

$site

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

$facebook

============================================================================================================================
========
Step 12:
========
===============================
Go To Administration Panel --> Templates
===============================
====================================
Create New Template: member_profile_facebook
====================================

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

============================================================================================================================
========
Step 13:
========
===============================
Go To Administration Panel --> Templates
===============================
=====================================
Create New Template: viewthread_post_facebook
=====================================

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

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

Upload image facebook.gif to all theme folders.

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