ne_one
05-10-2015, 01:29 AM
I have a WordPress plugin that retrieves the most recent vB threads. However, it's not quite working as expected and the developer has moved on.
The plugin has a parameter to limit the scope by passing a list of forum ids. When the parameter isn't specified, all forums are considered and data is returned. When populated with known forum ids, it doesn't return any data.
Here's the query:
SELECT t.threadid, t.lastposterid, t.lastposter, FROM_UNIXTIME(t.lastpost) as lastposttime, t.replycount, t.views, t.title, u.avatarid, u.avatarrevision, p.pagetext, NOT ISNULL(av.userid) as hascustomavatar FROM vb4_thread AS t INNER JOIN vb4_forum AS f ON f.forumid = t.forumid INNER JOIN vb4_user AS u ON u.userid = t.lastposterid INNER JOIN vb4_post AS p ON p.postid = t.lastpostid LEFT JOIN vb4_customavatar AS av ON av.userid = u.userid WHERE t.replycount != 0 AND f.forumid IN ( 1,2,3 ) AND visible="1" ORDER BY t.lastpost DESC LIMIT 10
The SQL syntax appears to be ok. Is the forum qualifier correct?
Thanks for your help!
The plugin has a parameter to limit the scope by passing a list of forum ids. When the parameter isn't specified, all forums are considered and data is returned. When populated with known forum ids, it doesn't return any data.
Here's the query:
SELECT t.threadid, t.lastposterid, t.lastposter, FROM_UNIXTIME(t.lastpost) as lastposttime, t.replycount, t.views, t.title, u.avatarid, u.avatarrevision, p.pagetext, NOT ISNULL(av.userid) as hascustomavatar FROM vb4_thread AS t INNER JOIN vb4_forum AS f ON f.forumid = t.forumid INNER JOIN vb4_user AS u ON u.userid = t.lastposterid INNER JOIN vb4_post AS p ON p.postid = t.lastpostid LEFT JOIN vb4_customavatar AS av ON av.userid = u.userid WHERE t.replycount != 0 AND f.forumid IN ( 1,2,3 ) AND visible="1" ORDER BY t.lastpost DESC LIMIT 10
The SQL syntax appears to be ok. Is the forum qualifier correct?
Thanks for your help!