diff --git a/lib/WebGUI/Affiliate.pm b/lib/WebGUI/Affiliate.pm new file mode 100644 index 000000000..d2e4ce6c1 --- /dev/null +++ b/lib/WebGUI/Affiliate.pm @@ -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; diff --git a/lib/WebGUI/User.pm b/lib/WebGUI/User.pm index 01d853149..82c3fe1cd 100644 --- a/lib/WebGUI/User.pm +++ b/lib/WebGUI/User.pm @@ -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