Skip to content

Commit f75b114

Browse files
authored
Merge pull request #94 from BigKev73/patch-12
Update TopicHandler.php
2 parents 089ec53 + f42553a commit f75b114

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

class/TopicHandler.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,22 @@ public function getTopPostId($topic_id)
242242
return $post_id;
243243
}
244244

245+
//Added by BigKev to get the next unread post ID based on the $lastreadpost_id
246+
public function getNextPostId($topic_id, $lastreadpost_id)
247+
{
248+
$sql = 'SELECT MIN(post_id) AS post_id FROM ' . $this->db->prefix('newbb_posts') . ' WHERE topic_id = ' . $topic_id . ' AND post_id > ' . $lastreadpost_id . ' ORDER BY post_id LIMIT 1';
249+
$result = $this->db->query($sql);
250+
if (!$result) {
251+
//xoops_error($this->db->error());
252+
return false;
253+
}
254+
[$post_id] = $this->db->fetchRow($result);
255+
256+
return $post_id;
257+
}
258+
259+
260+
245261
/**
246262
* @param $topic
247263
* @param string $order

0 commit comments

Comments
 (0)