added subscriptions

This commit is contained in:
JT Smith 2003-10-11 19:15:58 +00:00
parent 4388fa9b24
commit d17e7d0393
3 changed files with 124 additions and 29 deletions

View file

@ -65,5 +65,23 @@ sub set {
}
}
sub subscribe {
my ($self, $userId) = @_;
$userId = $session{user}{userId} unless ($userId);
unless ($self->isSubscribed($userId)) {
WebGUI::SQL->write("insert into forumSubscription (forumId, userId) values (".$self->get("forumId").",$userId)");
}
}
sub unsubscribe {
my ($self, $userId) = @_;
$userId = $session{user}{userId} unless ($userId);
if ($self->isSubscribed($userId)) {
WebGUI::SQL->write("delete from forumSubscription where forumId=".$self->get("forumId")." and userId=$userId");
}
}
1;