View Full Version : Search posts and froums
Boofo
08-20-2005, 02:23 PM
Can someone please tell me how to make the following query only allow searches show up for forums the user who is searching has access to? Right now it shows the word they searched for, and when they click on the word, if they do NOT have access to that forum, it shows the error message that there weren't any instances of the word found, even though it still shows in the list. Is there any way not to even have the word listed for those who can not view the forum?
$lastsearches = $db->query_read("
SELECT search.searchid, search.orderedids, search.dateline, search.query, search.userid, user.username, user.userid, user.usergroupid
FROM " . TABLE_PREFIX . "search,
" . TABLE_PREFIX . "user
WHERE search.query != ''
AND user.userid = search.userid
AND user.usergroupid NOT IN (5, 6, 7)
ORDER BY search.searchid DESC
LIMIT 0, 15
");
Marco van Herwaarden
08-20-2005, 07:05 PM
I don't really get your question. The list of words, is the words the user entered on the searchline, what got this to do with the forums? And i think the orderedids already contain a list of the threads found with the permissions considered.
What are you trying to do?
Boofo
08-20-2005, 07:20 PM
I am porting my Last 15 searches hack from 3.0 to 3.5. ;)
Right now it handles the permissions fine as the user can not get into a forum that they aren't supposed to. But the word they searched for WILL show up in the Last 15 Searches listing even though it is in a forum they can't access. I wouold like it to not show up in the listing for any forum that they don't have access to so they can't somehow stumble onto something that they really shouldn't.
And also, it shows the threads it is in instead of the individual posts. I would like to see it just display the posts.
Marco van Herwaarden
08-20-2005, 08:08 PM
It will just show the words used to search, doesn't matter if they are found or not i think.
I think you have set the search options to show as threads instead of posts then.
Boofo
08-20-2005, 08:18 PM
It will just show the words used to search, doesn't matter if they are found or not i think.
I think you have set the search options to show as threads instead of posts then.
How do I get it to not show the word then?
How do I set it to shows posts?
Marco van Herwaarden
08-20-2005, 08:21 PM
Do you anywhere query the post or the thread table then?
Edit: I have feeling we are both talking about complete different things, maybe i should just go sleep. :D
Boofo
08-20-2005, 08:25 PM
The query I am using is in the first post.
Marco van Herwaarden
08-21-2005, 08:05 AM
Well that query is not retrieving any thread/post/forum info, si i am really lost on what you mean now.
Boofo
08-22-2005, 07:58 PM
No, because it is using the search table. ;)
Marco van Herwaarden
08-22-2005, 09:00 PM
Yes and the search table will only give you id's, no forums or threads, so you will have to process them later.
Boofo
08-22-2005, 09:01 PM
Ok, so, how do we do that? ;)
Marco van Herwaarden
08-22-2005, 09:02 PM
Process the list. :D
Boofo
08-22-2005, 09:03 PM
I know you won't believe this Marco, but not everyone is as gifted as you in the coding department. If I knew how to do that, do you really think I would have even started this thread? ;)
Marco van Herwaarden
08-22-2005, 09:05 PM
I know you won't believe this Marco, but not everyone is as gifted as you in the coding department.
Working as designed.
If I knew how to do that, do you really think I would have even started this thread?Bogus
PS Start by looking at the 'orderedids'
Boofo
08-22-2005, 09:08 PM
ARRGGGHHHHHH!!!!!! Marco, you are frustrating! LOL
Marco van Herwaarden
08-22-2005, 09:17 PM
Try to catch me on msn tomorrow.
Boofo
08-22-2005, 09:21 PM
When is tomorrow for you?
And you might want to pm me your MSN details. That might help. ;)
Marco van Herwaarden
08-23-2005, 08:27 PM
My tomorrow is almost yesterday.
And you could have looked the monkey in his eyes.
Boofo
08-23-2005, 09:16 PM
LOL I figured I'd miss the boat.
Marco van Herwaarden
08-24-2005, 05:01 AM
Won't be online much today, but try again tomorrow. :D
Boofo
08-24-2005, 09:36 AM
Why don't you just pm me when and if you have some time?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.