Modification Name: PayPal Button in Posts v1.0

Modification Author: GuldantheWarlock (GuldantheWarlock@xmbgarage.com)

Modification Description:
This modification will add a paypal field to your profile that will display a secure paypal button in your posts.

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.

=======================================================================================================================
=======
Step 1:
=======
====================================
Go To Administration Panel --> Insert Raw SQL
====================================
===========================
Paste the following code and submit:
===========================

ALTER TABLE `$table_members` ADD `paypal` VARCHAR(75) NOT NULL default '';

=======================================================================================================================
=======
Step 2:
=======
=================
Edit File: memcp.php
=================
=
=====
Find:
======

loadtemplates(

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

loadtemplates(
'memcp_paypal',

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

        eval('echo stripslashes("'.template('memcp_profile').'");');
        
===========
Add Above:
===========

        // PayPal Button in Posts Mod Begin
        $paypalblock = '';
        if (X_STAFF) {
            eval('$paypalblock = "'.template('memcp_paypal').'";');
        }
        // PayPal Button in Posts Mod End

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

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

        // PayPal Button in Posts Mod Begin
        $newpaypal = formVar('newpaypal');
        $paypal = $newpaypal ? checkInput($newpaypal, 'no', 'yes', 'javascript', false) : '';
        // PayPal Button in Posts Mod End

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

        $sig = addslashes($sig);

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

        // PayPal Button In Posts Mod Begin
        $paypal = addslashes($paypal);
        // PayPal Button In Posts Mod End
        
======
Find:
======

        $db->query("UPDATE ".X_PREFIX."members SET
        
==========================================
Add to end of line before WHERE username='$xmbuser'");
==========================================

, paypal='$paypal'

=======================================================================================================
=======
Step 3:
=======
===================
Edit File: viewthread.php
===================
======
Find:
======

loadtemplates(

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

loadtemplates(
'viewthread_post_paypal',

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

        if ($post['author'] != 'Anonymous' && $post['username']) {
        
===========
Add Above:
===========

        // PayPal Button in Posts Mod Begin
        $paypal = '';
        $staffs = array('Super Administrator', 'Administrator', 'Super Moderator', 'Moderator');
        if (in_array($post['status'], $staffs) && $post['paypal'] != '') {
            eval('$paypal = "'.template('viewthread_post_paypal').'";');
        }
        // PayPal Button in Posts Mod End
        
======
Find:
======

            $location = '';
            $mood = '';
            
===========
Add Below:
===========

            // PayPal Button in Posts Mod Begin
            $paypal = '';
            // PayPal Button in Posts Mod End
        
=======================================================================================================
=======
Step 4:
=======
=======================
Edit File: lang/English.lang.php
=======================
=======================
Add To End Of File Above ?>
=======================

// PayPal Button in Posts Mod Begin
$lang['textpaypal'] = "PayPal&#8482;:";
$lang['paypalalt'] = "Make payments with PayPal - it's fast, free and secure!";
// PayPal Button in Posts Mod End

=======================================================================================================
=======
Step 5:
=======
===============================
Go To Administration Panel --> Templates
===============================

===================================
Create New Template: viewthread_post_paypal
===================================

<br />
$lang[textpaypal]<br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="$post[paypal]" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="tax" value="0" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" border="0" name="submit" alt="$lang[paypalalt]" />
</form>

=======================================================================================================
=======
Step 6:
=======
===============================
Go To Administration Panel --> Templates
===============================
=============================
Create New Template: memcp_paypal
=============================

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

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

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

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

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

$paypalblock

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

$mood

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

$paypal

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