PDA

View Full Version : Extend search


TiKu
08-31-2013, 04:29 PM
Hi,

I've extended the threads table by a couple of custom fields. Now I'd like to extend VB search to be able to search by these custom fields.
I use the 'search_start' hook to extend the search form. I guess I should use the 'search_advanced_filters' hook to extend the search query, but it seems like this hook never gets called. I placed nothing more but the following SQL query in my plugin:
$threadfield_get = $vbulletin->db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "thread_fields_admin1
WHERE find_in_set(fieldid,'1,2,3,4,5,8,9,51,52')
ORDER BY display
");This query contains a SQL syntax error by intent ("thread_fields_admin1" instead of "thread_fields_admin"), because I wanted to test whether this code actually gets executed.
Well, it doesn't get executed.
So am I using the wrong hook?

I plan to use $criteria->add_filter to extend the search query. Will this work? One limitation I already noticed is that you cannot add a filter that does a LIKE comparison. :(