summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/Discussions.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-10-10 15:51:57 +0200
committerYorhel <git@yorhel.nl>2009-10-10 15:51:57 +0200
commit5ce2ce4c494feef5940c032549472a52b5282ad1 (patch)
tree89efb88dc1fc0afbb2d4ba3b29a37e154453edeb /lib/VNDB/DB/Discussions.pm
parent1e125f67ab50a5de477c538b3f7dd27a9ec3c62f (diff)
Display number of unread posts in user menu
Instead of displaying the total number of threads. Posts are marked as read when the thread is opened.
Diffstat (limited to 'lib/VNDB/DB/Discussions.pm')
-rw-r--r--lib/VNDB/DB/Discussions.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/VNDB/DB/Discussions.pm b/lib/VNDB/DB/Discussions.pm
index 26beaaee..60487098 100644
--- a/lib/VNDB/DB/Discussions.pm
+++ b/lib/VNDB/DB/Discussions.pm
@@ -5,7 +5,7 @@ use strict;
use warnings;
use Exporter 'import';
-our @EXPORT = qw|dbThreadGet dbThreadEdit dbThreadAdd dbPostGet dbPostEdit dbPostAdd dbThreadCount|;
+our @EXPORT = qw|dbThreadGet dbThreadEdit dbThreadAdd dbPostGet dbPostEdit dbPostAdd dbThreadCount dbPostRead|;
# Options: id, type, iid, results, page, what, notusers
@@ -243,5 +243,15 @@ sub dbPostAdd {
}
+sub dbPostRead { # thread id, user id, last post number
+ my($s, $tid, $uid, $num) = @_;
+ $s->dbExec(q|
+ UPDATE threads_boards
+ SET lastread = ?
+ WHERE tid = ? AND type = 'u' AND iid = ?|,
+ $num, $tid, $uid);
+}
+
+
1;