adding a simple affiliate program

This commit is contained in:
JT Smith 2003-09-29 18:18:29 +00:00
parent 2bd21c7d0b
commit d1fe30f9d2
2 changed files with 37 additions and 1 deletions

36
lib/WebGUI/Affiliate.pm Normal file
View file

@ -0,0 +1,36 @@
package WebGUI::Affiliate;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2003 Plain Black LLC.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::User;
#-------------------------------------------------------------------
sub grabReferral {
if ($session{user}{userId} != 1 && $session{user}{referringAffiliate} > 0) {
return "";
} elsif ($session{user}{userId} != 1 && $session{user}{referringAffiliate} == 0) {
my $u = WebGUI::User->new($session{user}{userId});
$u->referringAffiliate($session{scratch}{referringAffiliate});
WebGUI::Session::deleteScratch("referringAffiliate");
} elsif ($session{form}{affiliateId} ne "") {
WebGUI::Session::setScratch("referringAffiliate",$session{form}{affiliateId});
}
}
1;

View file

@ -308,7 +308,7 @@ sub profileField {
=head2 referringAffiliate ( [ value ] )
Returns the unique identifier of the affiliate the referred this user to the site.
Returns the unique identifier of the affiliate that referred this user to the site.
=over