[Beta] Referral Allowance [Addon]

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

[Beta] Referral Allowance [Addon]

Post 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
Last edited by LaZeR on Sun Dec 22, 2002 9:09 am, edited 1 time in total.
pollix
Registered User
Posts: 153
Joined: Tue Jul 23, 2002 6:29 pm
Location: Ridgecrest, CA
Contact:

Post 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.
User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post 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);
pollix
Registered User
Posts: 153
Joined: Tue Jul 23, 2002 6:29 pm
Location: Ridgecrest, CA
Contact:

Post 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.
User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post 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);
jhaskins
Registered User
Posts: 32
Joined: Wed Apr 17, 2002 10:20 pm
Contact:

Post 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?
Antony
Registered User
Posts: 529
Joined: Wed Feb 12, 2003 9:06 am

Post by Antony »

Works good. :D
I've Been Banned!
User avatar
shirleycaat
Registered User
Posts: 186
Joined: Mon Apr 07, 2003 1:11 am

Post 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!
deerdork
Registered User
Posts: 115
Joined: Thu Jan 30, 2003 7:44 pm
Location: Dayton OH
Contact:

Post by deerdork »

bump

and i second shirleycaat's requests
AndrewThomas
Registered User
Posts: 215
Joined: Sun Aug 10, 2003 2:17 am

Post by AndrewThomas »

i third shirleys request

and what about this working with CASH MOD??
www.technoputa.com

Cause EVERYONE Listens To Techno
deerdork
Registered User
Posts: 115
Joined: Thu Jan 30, 2003 7:44 pm
Location: Dayton OH
Contact:

Post 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.
Xore
Former Team Member
Posts: 2594
Joined: Wed Apr 16, 2003 7:42 pm
Location: the wastelands between insomnia and clairvoyance
Contact:

Post 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.
Camels in the Mist
<noise type="random" source="camel" />
Cash Mod
User avatar
hshah
Registered User
Posts: 357
Joined: Sun May 25, 2003 7:23 am
Location: Utopia

Post by hshah »

again, the cash is not deleted after the user is!

anyone?
Join the OcUK Cyber Nations Alliance
http://hirenshah.co.uk/ocuk
Rat Rescue
Registered User
Posts: 207
Joined: Thu Aug 07, 2003 11:08 pm

Post by Rat Rescue »

Will this mod work with this one:

http://www.phpbbhacks.com/viewhack.php?id=435
User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post 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:
Post Reply

Return to “[2.0.x] MODs in Development”