MyBB Community Forums

Full Version: View Unread Posts problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm getting an SQL caused by View Unread Posts due to added code in inc/functions_indicators.php.  The following code was added by Unread posts:


        // START - Unread posts MOD
        $forums_to_read[] = $fid;
        $fids = implode(',', $forums_to_read);
        $db->query("DELETE TTR.*
                        FROM " . TABLE_PREFIX . "threadsread AS TTR
                        INNER JOIN " . TABLE_PREFIX . "threads AS TT ON TT.tid = TTR.tid
                        WHERE TTR.uid = '" . $mybb->user['uid'] . "' AND TT.fid IN (" .
        // END - Unread posts MOD


I don't see it anywhere in the plugin so I figure it's from an older version?  Is it safe to delete this?

MyBB ver: 1.8.7
PostgreSQL 8.1
View Unread Posts: 1.4.2

Thanks!
Vince.
I get this message error

SELECT 1 FROM mybbf_posts p INNER JOIN mybbf_threads t ON (p.tid = t.tid) LEFT JOIN mybbf_threadsread tr ON (tr.uid = 20 AND t.tid = tr.tid) LEFT JOIN
I have the same problem 

SELECT COUNT(ts.tid) as threads
		FROM mybb_threadsubscriptions ts
		LEFT JOIN mybb_threads t ON (t.tid = ts.tid)
		left join mybb_threadsread tr on t.tid = tr.tid and tr.uid = '414'
		WHERE ts.uid = '414' and (tr.dateline < t.lastpost or tr.dateline is null) and t.lastpost >  AND t.visible != 0

Any solution?
(2017-01-23, 03:18 PM)alo_bonzo Wrote: [ -> ]I have the same problem 

SELECT COUNT(ts.tid) as threads
		FROM mybb_threadsubscriptions ts
		LEFT JOIN mybb_threads t ON (t.tid = ts.tid)
		left join mybb_threadsread tr on t.tid = tr.tid and tr.uid = '414'
		WHERE ts.uid = '414' and (tr.dateline < t.lastpost or tr.dateline is null) and t.lastpost >  AND t.visible != 0

Any solution?

This query is broken in several ways and is only going to work for the user with the uid "414" so hope that's ok. Here's a few syntax fixes at least:
SELECT COUNT(ts.tid) as threads
		FROM mybb_threadsubscriptions ts
		LEFT JOIN mybb_threads t ON (t.tid = ts.tid)
		LEFT JOIN mybb_threadsread tr ON (t.tid = tr.tid)
		WHERE ts.uid = '414' AND(tr.dateline < t.lastpost or tr.dateline is null) and t.lastpost > **a number needs to go here** AND t.visible != 0