MyBB Community Forums

Full Version: Change search query with a plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have developed a plugin using which users can tag their threads. I am almost done, except for writing the code to search by tag. The user shall search by clicking on the tag.

The tags for the threads are stored in a separate table.
Engine: MySQL
Table: Tags
2 Fields:
#1 TID - id of the thread
#2 Tags - comma separated tags

How do I modify the query to include the tag? I know I will have to use a select join query, but which exactly to use and which variable to pass?

Please guide me.
OR, other way is to manipulate the searchlog table, but again, how to fill the 'threads' and
'posts' fields?

Please help.
OK. I got that threads field contains the ID's of the threads that matched the keyword. But the similar approach does not work with posts.

Also, I would like to have the "resulttype" field set to 'threads' only. No 'posts'. So should I even worry about the 'posts' field? Can I just go ahead with the threads field?