Here's the fix for the searching. Replace post_thanks.php with this file.
What was wrong:
It was looking in an old table 'search' for the results. This no longer works.
What was fixed:
I have the initial SQL statement grab the thread IDs and post IDs:
PHP Code:
$posts = $db->query_read("
SELECT postid, post.threadid as threadid
Then, we need to throw them into an array:
PHP Code:
while ($post = $db->fetch_array($posts))
{
$orderedids[] = array("1", $post['postid'], $post['threadid']);
}
The old code is commented out in other areas.
Then, we need to create our query to match the way vB 4.x wants it.
PHP Code:
$scriteria = $search_core->create_criteria(vB_Search_Core::SEARCH_ADVANCED);
$scriteria->set_advanced_typeid($vbulletin->GPC['contenttypeid']);
$scriteria->set_grouped(vB_Search_Core::GROUP_NO);
$crit = "'" . $db->escape_string(serialize($scriteria)) . "'";
$hash = "'" . $db->escape_string($scriteria->get_hash()) . "'";
//results, confirmed, groups_seen, groups_rejected
$sresults = serialize(array($orderedids, "0", array(), array()));
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "searchlog (userid, ipaddress, searchhash, sortby, sortorder, searchtime, dateline, completed, criteria, results)
VALUES (" . $vbulletin->userinfo['userid'] . ", '" . $db->escape_string(IPADDRESS) . "', $hash, 'groupdateline', 'desc', '0.999', UNIX_TIMESTAMP(NOW()), 1, $crit, '$sresults')");
$searchid = $db->insert_id();
We create our search criteria, serialize it and then get the hash of it. We then serialize our IDs. The way vB's results.php wants the results is ordered such as:
array of threadIDs/postIDs
number of 'confirmed' posts (No idea what this is, left it as 0).
array of groups seen (No idea on this, just make an empty array).
array of groups denied (Again, no clue. Just made an empty array).
We then insert the data into the searchlog table and use that to generate the search results. I also included some various files at the beginning and setup a variable for the whole search thing:
PHP Code:
require_once(DIR . "/vb/search/core.php");
require_once(DIR . "/vb/search/resultsview.php");
$search_core = vB_Search_Core::get_instance();
That's it. Searching via User CP should work.