Finally got around to putting this together myself. Unsure how "optimized" it is ... but here's the core of it.
PHP Code:
if ($_REQUEST['do'] == 'searchresults')
{
$vbulletin->input->clean_array_gpc('r', array(
'sk' => TYPE_STR,
'st' => TYPE_INT,
));
// ATTN Compatibility Code
$sk =& $vbulletin->GPC['sk'];
$st =& $vbulletin->GPC['st'];
// ATTN Compatibility Code
if ($st==4)
{
$total= $db->query_first("
SELECT COUNT(*) AS entries FROM " . TABLE_PREFIX . "event
WHERE title LIKE '%".$db->escape_string($sk)."%' AND visible=1
");
$getentries= $db->query("
SELECT title,calendarid,visible,eventid,dateline_from FROM " . TABLE_PREFIX . "event
WHERE visible=1 AND title LIKE '%".$db->escape_string($sk)."%'
ORDER BY dateline_from DESC
LIMIT 50
");
}
if ($total['entries']<1)
{
$resultbits="<div align=\"center\"><b>$vbphrase[no_results_found]</b></div>";
}
else
{
while($entry= $db->fetch_array($getentries))
{
$entry[date]= vbdate($vbulletin->options['dateformat'], $entry['dateline_from'],false,true,false,true);
if (strlen($entry['title'])>300)
{
$entry['title']= "".substr($entry['title'], 0, 300)."...";
}
eval('$resultbits .= "' . fetch_template('eventsearchresults') . '";');
}
$db->free_result($entry);
}
It works - you just have to be skilled enough to put it together in your own script though. For legal reasons I can't really give any more help ... but I figured this would be a start for anyone looking to add an "event search" on their forum. So ... take ... use ... adapt ... hope it can help someone.
Note: if you don't want case sensitive searching - change event.title from utf_8 to "latin".