![]() |
help.. permission check for "last 5 posts.."
Hi
Could someone urgently amend this query for me to exclude posts the viewing user does not have permission to view? $threads = $vbulletin->db->query_read("SELECT threadid, title, lastpost, lastposter FROM " . TABLE_PREFIX . "thread WHERE visible = '1' AND open = '1' ORDER BY lastpost DESC LIMIT 5 "); Thanks Simon |
This gets the last 5 threads. I would've edit it to show the last 5 posts but I'll let you do that.
PHP Code:
|
2 tips:
-Do the forum permission checking prior to the query (generating a comma-delimited list of forumids they can or can't see): WHERE forumid NOT IN ($ids) -Only show posts from the past few days, which would utilize the date index (greatly reducing the amount of juice it will take to bring up the records) |
Thanks guys :)
I've changed it to the following (which I've taken from somewhere, can't remember where now!) .. Code:
$blockforums = ""; Thanks again Simon |
All times are GMT. The time now is 04:04 PM. |
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:
|