Skip to content

Commit 8677d9e

Browse files
authored
Merge pull request #95 from BigKev73/patch-13
Update ForumHandler.php
2 parents f75b114 + d392aa2 commit 8677d9e

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

class/ForumHandler.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ public function getAllTopics($forum, $criteria = null)
178178
require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.time.php');
179179
require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.read.php');
180180
require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.topic.php');
181+
182+
//BigKev73 > Added this to suport the call into the Topic Handler
183+
$topicHandler = Helper::getInstance()->getHandler('Topic');
181184

182185
$criteria_vars = ['startdate', 'start', 'sort', 'order', 'type', 'status', 'excerpt'];
183186
foreach ($criteria_vars as $var) {
@@ -387,7 +390,14 @@ public function getAllTopics($forum, $criteria = null)
387390
if (!empty($lastRead)){
388391
if ($lastRead<$myrow['topic_last_post_id']){
389392
$topicLink = 'viewtopic.php?post_id=' . $lastRead . '#forumpost'.$lastRead;
390-
}
393+
//BigKev73 > Adding this code to support jumping to the next post after the LastReadPost, otherwise we could end up on the prior page
394+
// if the lastread post is not on the last page and the next new post. Added getNextPostId to topichandler to support this
395+
$nextPostID = $topicHandler->getNextPostId($myrow['topic_id'],$lastRead);
396+
if(!empty($nextPostID)){
397+
$topicLink = 'viewtopic.php?post_id=' . $nextPostID . '#forumpost'.$nextPostID;
398+
print ('LastRead='.$lastRead. ', NextPostID= ' . $nextPostID);
399+
}
400+
}
391401
}
392402
}
393403
}

0 commit comments

Comments
 (0)