![]() |
Pulling only "visible" threads from the database
I'm pulling the latest threads from the database to link to them from another page. I just want to be sure to only pull "visible" ie not moderated and deleted threads. Is the 'visible' field the right one to use or is there something I should do with the 'hiddencount' and 'deletedcount' fields?
Code:
select `title` , `threadid` from `thread` where `visible`=1 order by `threadid` desc limit 5 |
Also be aware that if you're not checking user permissions these threads could be pulled from anywhere in your forums. But I believe that will do what you want.
|
Thanks Zach,
Right now I don't have any hidden/mod forums, but if/when I do, then I could simply check the forumid in the threads table and exclude my hidden forums right? Other than that, and just for confirmation, the visible field is what gets set to 0 when a thread is in the moderation queue or is deleted? Thanks a bunch, |
0 Soft deleted 1 visable 2 moderated I believe
|
OK, Thanks a lot, I appreciate it. :)
|
You also need to check that the open field does not equal 10 - if it does then it's a redirect, not a real thread.
|
Thanks Paul for that! That eventuality hadn't even occurred to me. :)
|
All times are GMT. The time now is 04:35 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|