unread topics logic

Marc

Well-known member
Hi guys,
Trying to help out a user who would like to put unread topics from a specific forum in another area of his forum. Have been looking through the tables to see how I could get this, and have come up with the following:

Code:
SELECT * FROM `xf_thread` T
LEFT JOIN xf_thread_read TR ON TR.thread_ID = T.thread_id AND
T.last_post_date
> TR.thread_read_date

WHERE T.node_id = 22 AND TR.User_ID = 1

Which I thought would give me all the topics I had not read withing a specific forum. In this case the forum with node_id of 22. Now Im guessing I am missing something here, possibly a table. As if I click to mark the whole forum as read, this does not reduce my query to 0 which is what I expected. Please could someone enlighten me as to what I am doing wrong?
 
Ooooo shiny functions xenforo_Model_Thread=>getUnreadThreadIds($userId,array $fetchOptions = array())
 
Top Bottom