Page 1 of 2

[Beta] Referral Allowance [Addon]

Posted: Sun Dec 22, 2002 7:18 am
by LaZeR
I know there was some demand for reward support to AbelaJohnB's Referral Mod via a points style system so I came up with the following utilizing Napoleon's Allowance system. I credit both of the mentioned author's for the ability to have a use for this mod as it requires both to be installed.

PS: This utilizes the current "Allowance" from any of Napoleon's mods if you've already installed Tetris and use this system instead of Points or Quiz ofcourse. Should take minor tweaking to convert to "Points" if you desire. :wink:

Code: Select all

#################################################################
## MOD Title: Referral Allowance [Addon]
## MOD Author: LaZeR <lzerace@msn.com> (Ron L.) http://www.oasisforum.valcato.net/phpbb/portal.php
## MOD Description: Creates a points style crediting system tying together AbelaJohnB's Referral Mod
##                  with Napoleon's Allowance system.
##                                   
## MOD Version: 0.9.0
##
## Installation Level: Easy
## Installation Time: 5 minutes
## Files To Edit: 
##                   includes/usercp_register.php
##
## Included Files:
##                   None
##                   
#################################################################
## MOD History:
##
##	0.9.0 - 12/22/2002 - Initial Release
#################################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
#################################################################
##
## Author Note: 
##
## This is simply an addon and requires the "Referral Mod" by AbelaJohnB <abela@phpbb> (John B. Abela) http://www.johnabela.com/
## and the "Allowance System" by Napoleon <napoleon@gigaknight.com> (Christopher Moore) http://www.gigaknight.com/community/index.php
## both to be installed on your board first and working properly. Tested with the "Referral Mod" v1.0.3 and the allowance system via
## "Quiz MOD" v0.1.0. As mentioned above, both of these original mods are copyright to the listed owners.
##
## Important! Replace the below SQL prefix to _config with your appropriate prefix if different than default phpbb and change the number
## 50 to your desired reward amount before running the SQL query!
##
## Future Plans:
##                 
## Add ACP support to control reward amount for referrals via ACP in the "Allowance System" of Napoleon with his permission.
## 
##
##
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################
#
#-----[ SQL ]------------------------------------------
#
INSERT INTO phpbb_config VALUES ('referall_reward', '50');

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php

#
#-----[ FIND ]------------------------------------------
#
            if ($ruid != '')
            {
                $ruid = stripslashes($ruid);
                $sql = "INSERT INTO " . REFERRAL_TABLE . "	(referral_id, ruid, nuid, referral_time) 
                VALUES ('', '" . str_replace("\'", "''", $ruid) . "', '" . str_replace("\'", "''", $user_id) . "', '" . time() . "')";
                //
                if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
                {
                    message_die(GENERAL_ERROR, 'Could not insert data into referrals table', '', __LINE__, __FILE__, $sql);
                }                

#
#-----[ AFTER, ADD ]------------------------------------------
#
		$user_money = $user_money + $board_config['referall_reward'];
                $sql = "UPDATE " . USERS_TABLE . "
                       SET user_money = user_money + $user_money
                       WHERE user_id = '" . str_replace("\'", "''", $ruid) . "'";
                if( !$db->sql_query($sql) )
                {
                    message_die(GENERAL_ERROR, 'Could not Update Users ' . $board_config['money_name'], '', __LINE__, __FILE__, $sql);
                }                

#
#-----[  SAVE/CLOSE ALL FILES ]------------------------------------------
#EoM

Posted: Sun Dec 22, 2002 8:31 am
by pollix
For the points mod... follow all the above instructions. When editing usercp_register.php follow the below instructions.

In includes/usercp_register.php:

FIND:

Code: Select all

if ($ruid != '') 
            { 
                $ruid = stripslashes($ruid); 
                $sql = "INSERT INTO " . REFERRAL_TABLE . "   (referral_id, ruid, nuid, referral_time) 
                VALUES ('', '" . str_replace("\'", "''", $ruid) . "', '" . str_replace("\'", "''", $user_id) . "', '" . time() . "')"; 
                // 
                if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) ) 
                { 
                    message_die(GENERAL_ERROR, 'Could not insert data into referrals table', '', __LINE__, __FILE__, $sql); 
                }
ADD AFTER:

Code: Select all

$user_points = $user_points + $board_config['referall_reward'];
                $sql = "UPDATE " . USERS_TABLE . "
                       SET user_points = user_points + $user_points
                       WHERE user_id = '" . str_replace("\'", "''", $ruid) . "'";
                if( !$db->sql_query($sql) )
                {
                    message_die(GENERAL_ERROR, 'Could not Update Users ' . $board_config['points_name'], '', __LINE__, __FILE__, $sql);
                }
save upload file.

Posted: Sun Dec 22, 2002 8:54 am
by LaZeR
Thanks pollix. That was simple enough :wink: I probably have the error line a bit whack but should not effect the operation of the mod. Feel free to correct me on this part and I will fix the original properly:

Code: Select all

message_die(GENERAL_ERROR, 'Could not Update Users table value [user_money]', '', __LINE__, __FILE__, $sql);

Posted: Sun Dec 22, 2002 9:03 am
by pollix
I already encountered the error before I made it work. The error comes out correctly! Well at least for the points_mod part of it.

I got "Could not update users drunk bucks." Sounds like a good error to me.

Posted: Sun Dec 22, 2002 9:12 am
by LaZeR
pollix wrote: I got "Could not update users drunk bucks." Sounds like a good error to me.


Lol :lol: Well I updated the original (First post) for the allowance add-on from the goofy error line I had before :oops: :

Code: Select all

message_die(GENERAL_ERROR, 'Could not Update Users table value [user_money]', '', __LINE__, __FILE__, $sql);

TO:

Code: Select all

message_die(GENERAL_ERROR, 'Could not Update Users ' . $board_config['money_name'], '', __LINE__, __FILE__, $sql);

Posted: Tue Mar 11, 2003 12:49 am
by jhaskins
I have user account activation enabled on my board. I would like to use this mod, but fear abuse (the last thing I need is more unconfimed accounts). Is there a way to keep this from giving out points until the person who was referred activates his account?

Posted: Tue Jun 10, 2003 5:31 pm
by Antony
Works good. :D

Posted: Sat Jun 14, 2003 5:31 am
by shirleycaat
Hello,

The MOD works fine. Thanks.

I have a question though.
How to decrease the Points/Money obtained by referral when the referred account is deleted? (I'm using Point System, I dont know whether other systems can do this job. )

And of course, as jhaskins said, the Points/Money should be sent out only when the person's account has activated.

Otherwise, if the points can be obtained easily by abuse, the reward will be pointless!

Posted: Mon Sep 01, 2003 1:19 am
by deerdork
bump

and i second shirleycaat's requests

Posted: Thu Sep 04, 2003 7:53 am
by AndrewThomas
i third shirleys request

and what about this working with CASH MOD??

Posted: Fri Sep 05, 2003 12:15 am
by deerdork
it should work with the cash mod if you have user_points as one of you curencies... but dont quote me on it...

i have it set up with cash mod... but i havent tested it yet so i dont know for sure if it works

but yeah it you use the following code then it could work
pollix wrote: For the points mod... follow all the above instructions. When editing usercp_register.php follow the below instructions.

In includes/usercp_register.php:

FIND:

Code: Select all

if ($ruid != '') 
            { 
                $ruid = stripslashes($ruid); 
                $sql = "INSERT INTO " . REFERRAL_TABLE . "   (referral_id, ruid, nuid, referral_time) 
                VALUES ('', '" . str_replace("\'", "''", $ruid) . "', '" . str_replace("\'", "''", $user_id) . "', '" . time() . "')"; 
                // 
                if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) ) 
                { 
                    message_die(GENERAL_ERROR, 'Could not insert data into referrals table', '', __LINE__, __FILE__, $sql); 
                }
ADD AFTER:

Code: Select all

$user_points = $user_points + $board_config['referall_reward'];
                $sql = "UPDATE " . USERS_TABLE . "
                       SET user_points = user_points + $user_points
                       WHERE user_id = '" . str_replace("\'", "''", $ruid) . "'";
                if( !$db->sql_query($sql) )
                {
                    message_die(GENERAL_ERROR, 'Could not Update Users ' . $board_config['points_name'], '', __LINE__, __FILE__, $sql);
                }
save upload file.

Posted: Fri Sep 05, 2003 5:42 am
by Xore
For Cash Mod, if you go into your Cash Currencies admin panel, you will see a list of currencies, each with an associated database field of the nature 'user_' (plus some word).

for whichever currency you want, replace 'user_points' with that database field.

Edit: many of you will have this set to 'user_points' but others may not.
pollix wrote: For the points mod... follow all the above instructions. When editing usercp_register.php follow the below instructions.

In includes/usercp_register.php:

FIND:

Code: Select all

if ($ruid != '') 
            { 
                $ruid = stripslashes($ruid); 
                $sql = "INSERT INTO " . REFERRAL_TABLE . "   (referral_id, ruid, nuid, referral_time) 
                VALUES ('', '" . str_replace("\'", "''", $ruid) . "', '" . str_replace("\'", "''", $user_id) . "', '" . time() . "')"; 
                // 
                if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) ) 
                { 
                    message_die(GENERAL_ERROR, 'Could not insert data into referrals table', '', __LINE__, __FILE__, $sql); 
                }
ADD AFTER:

Code: Select all

$user_points = $user_points + $board_config['referall_reward'];
                $sql = "UPDATE " . USERS_TABLE . "
                       SET user_points = user_points + $user_points
                       WHERE user_id = '" . str_replace("\'", "''", $ruid) . "'";
                if( !$db->sql_query($sql) )
                {
                    message_die(GENERAL_ERROR, 'Could not Update Users ' . $board_config['points_name'], '', __LINE__, __FILE__, $sql);
                }
save upload file.

Posted: Thu Dec 11, 2003 3:07 pm
by hshah
again, the cash is not deleted after the user is!

anyone?

Posted: Tue Apr 13, 2004 4:34 pm
by Rat Rescue
Will this mod work with this one:

http://www.phpbbhacks.com/viewhack.php?id=435

Posted: Tue Apr 13, 2004 5:02 pm
by LaZeR
Rat Rescue wrote: Will this mod work with this one:

http://www.phpbbhacks.com/viewhack.php?id=435


Yes it should. Just do what Xore mentioned two posts up. :wink: