Hello, I'm writing a tagging module to allow users to tag threads with a simple array of strings. I'm using v5.2
The way I've done this in other modules is to store the array in the first post's metadata (parent_id = 0). Easy enough.
But, the challenge here is how to filter the thread list by those meta tags. I think I have two options:
1. Add tag support to search.php
2. Filter the topc list via list.php
Option #1 - Adding a new parameter to the search is easy enough, and there is already a hook "search_action" that allows a module to bypass the built-in phorum_db_search(). However, that would require writing a new phorum_db_search() as the existing DB layer functions don't have hooks. I don't need to combine tag search with the other search params, so that makes it fairly easy. However, I would have to somehow parse/search the "meta" column within the search SQL itself - very hacky/fragile
Option #2 - Modify the thread list to filter by tag(s). Looking at list.php, there doesn't seem to be a standard hook to bypass the built-in phorum_db_get_thread_list() - but it would be easy enough to add a new phorum_hook call. But, then I'm in the same position of writing a new phorum_db_get_thread_list() to SQL search the serialized meta data just like before.
Any tips or tricks or hints or thoughts on this? Do any other modules implement SQL meta data search that I can look at?
Thanks,
Skye
The way I've done this in other modules is to store the array in the first post's metadata (parent_id = 0). Easy enough.
But, the challenge here is how to filter the thread list by those meta tags. I think I have two options:
1. Add tag support to search.php
2. Filter the topc list via list.php
Option #1 - Adding a new parameter to the search is easy enough, and there is already a hook "search_action" that allows a module to bypass the built-in phorum_db_search(). However, that would require writing a new phorum_db_search() as the existing DB layer functions don't have hooks. I don't need to combine tag search with the other search params, so that makes it fairly easy. However, I would have to somehow parse/search the "meta" column within the search SQL itself - very hacky/fragile
Option #2 - Modify the thread list to filter by tag(s). Looking at list.php, there doesn't seem to be a standard hook to bypass the built-in phorum_db_get_thread_list() - but it would be easy enough to add a new phorum_hook call. But, then I'm in the same position of writing a new phorum_db_get_thread_list() to SQL search the serialized meta data just like before.
Any tips or tricks or hints or thoughts on this? Do any other modules implement SQL meta data search that I can look at?
Thanks,
Skye