From db235bd4685ed7e974199d2d501f549877b95a96 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 22 Apr 2015 00:16:52 -0700 Subject: [PATCH] Possibly related to issue #809. --- e107_plugins/forum/forum_class.php | 2 +- e107_plugins/forum/forum_viewtopic.php | 13 +++++++++++-- .../forum/shortcodes/batch/view_shortcodes.php | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index fe199f2ca..0b0c26764 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -1248,7 +1248,7 @@ class e107forum { $_tmp[] = (int)$tid; } - $tmp = array_unique($tmp); + $tmp = array_unique($_tmp); $viewed = trim(implode(',', $_tmp), ','); return e107::getDb()->update('user_extended', "user_plugin_forum_viewed = '{$viewed}' WHERE user_extended_id = ".USERID); } diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php index 6748d6c02..29fe1137c 100644 --- a/e107_plugins/forum/forum_viewtopic.php +++ b/e107_plugins/forum/forum_viewtopic.php @@ -406,18 +406,27 @@ if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread } - + $mes = e107::getMessage(); $forend = $tp->simpleParse($FORUMEND, $tVars); $forumstring = $forstr . $forthr . vartrue($forrep) . $forend; //If last post came after USERLV and not yet marked as read, mark the thread id as read $threadsViewed = explode(',', $currentUser['user_plugin_forum_viewed']); + if ($thread->threadInfo['thread_lastpost'] > USERLV && !in_array($thread->threadId, $threadsViewed)) { $tst = $forum->threadMarkAsRead($thread->threadId); + $mes->addDebug("Marking Forum as read: ".$thread->threadId." result: ".$tst); } -$mes = e107::getMessage(); +else +{ + $ret = array('lastpost'=>$thread->threadInfo['thread_lastpost'], 'lastvisit'=>USERLV, 'thread'=>$thread->threadId, 'viewed'=>$threadsViewed); + $mes->addDebug(print_a($ret,true)); + unset($ret); +} + + require_once (HEADERF); diff --git a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php index ebd4a5742..17c9b95c1 100644 --- a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php @@ -428,7 +428,7 @@ class plugin_forum_view_shortcodes extends e_shortcode // $text .= $this->sc_level('pic'); $ue = $tp->parseTemplate("{USER_EXTENDED=location.text_value}",true); - $username = $this->postInfo['user_name']; + $username = (empty($this->postInfo['user_name'])) ? LAN_ANONYMOUS : $this->postInfo['user_name']; $text = '