added a rudamentary affiliate tracking program

This commit is contained in:
JT Smith 2003-08-29 22:13:19 +00:00
parent 781526066f
commit ac102923ce
5 changed files with 37 additions and 3 deletions

View file

@ -198,7 +198,7 @@ sub www_createAccountSave {
$u->profileField($fieldName,${$profile}{$fieldName});
}
WebGUI::Authentication::registrationFormSave($u->userId);
WebGUI::Session::start($u->userId);
WebGUI::Session::convertVisitorToUser($session{var}{sessionId},$u->userId);
_logLogin($u->userId,"success");
system(WebGUI::Macro::process($session{setting}{runOnRegistration})) if ($session{setting}{runOnRegistration} ne "");
WebGUI::MessageLog::addInternationalizedEntry('',$session{setting}{onNewUserAlertGroup},'',536) if ($session{setting}{alertOnNewUser});

View file

@ -50,6 +50,7 @@ TIP: The $session variable is a case-insensitive hash. The contents of the has v
use WebGUI::Session;
WebGUI::Session::close();
WebGUI::Session::convertVisitorToUser($sessionId,$userId);
WebGUI::Session::deleteScratch($name);
WebGUI::Session::end($sessionId);
$header = WebGUI::Session::httpHeader();
$header = WebGUI::Session::httpRedirect($url);

View file

@ -42,6 +42,7 @@ This package provides an object-oriented way of managing WebGUI users as well as
$karma = $u->karma;
$lastUpdated = $u->lastUpdated;
$languagePreference = $u->profileField("language",1);
$referringAffiliate = $u->referringAffiliate;
$status = $u->status("somestatus");
$username = $u->username("jonboy");
@ -305,6 +306,34 @@ sub profileField {
#-------------------------------------------------------------------
=head2 referringAffiliate ( [ value ] )
Returns the unique identifier of the affiliate the referred this user to the site.
=over
=item value
An integer containing the unique identifier of the affiliate.
=back
=cut
sub referringAffiliate {
my ($class, $value);
$class = shift;
$value = shift;
if (defined $value) {
$class->{_user}{"referringAffiliate"} = $value;
WebGUI::SQL->write("update users set referringAffiliate=".$value.",
lastUpdated=".time()." where userId=$class->{_userId}");
}
return $class->{_user}{"referringAffiliate"};
}
#-------------------------------------------------------------------
=head2 status ( [ value ] )
Returns the status of the user.