added subscriptions
This commit is contained in:
parent
4388fa9b24
commit
d17e7d0393
3 changed files with 124 additions and 29 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue