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

@ -13,6 +13,7 @@ our $VERSION = "5.5.0";
use strict qw(vars subs);
use Tie::CPHash;
use WebGUI::Affiliate;
use WebGUI::Cache;
use WebGUI::ErrorHandler;
use WebGUI::Icon;
@ -77,8 +78,7 @@ sub _generatePage {
}
if(!WebGUI::Privilege::canViewWobject($wobject->{wobjectId})){ next; }
if (${$wobject}{namespace} eq "WobjectProxy") {
if (${$wobject}{namespace} eq "WobjectProxy") {
$originalWobject = $wobject;
my ($wobjectProxy) = WebGUI::SQL->quickHashRef("select * from WobjectProxy where wobjectId=".${$wobject}{wobjectId});
$wobject = WebGUI::SQL->quickHashRef("select * from wobject where wobject.wobjectId=".$wobjectProxy->{proxiedWobjectId});
@ -225,6 +225,7 @@ sub page {
$content = $cache->get;
}
$operationOutput = _processOperations();
WebGUI::Affiliate::grabReferral();
$wobjectOutput = _processFunctions();
if ($operationOutput eq "" && $wobjectOutput eq "" && $session{form}{action2} ne "") {
_processAction($session{form}{action2});

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.