Hi!
I've been pulling my hair out trying to build a searchbot that will integrate CB into the core search function of Joomla. I can get it to variously do nothing, or to kill the search function entirely. Either way it's not working. I'm hoping someone can take a peek at the php code and let me know what I'm missing.
Ideally, I want to be able to search by a few fields: firstname, tags, and a member number.
Any help would be appreciated!
Thanks!
-Andy
<?php
/**
* @version $Id $
* @package Mambo_4.5
* @copyright (C) 2000 - 2004 Miro International Pty Ltd
* @license
www.gnu.org/copyleft/gpl.html
GNU/GPL
* Mambo is Free Software
*/
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$_PLUGINS->registerFunction( 'onSearch', 'botSearchCB' );
/**
* Search method
* @param array Named 'text' element is the search term
*/
function botSearchCB( $text ) {
global $database;
$text = trim( $text );
if ($text == '') {
return array();
}
$database->setQuery( "SELECT firstname AS title,"
. " '' AS created,"
. " cb_tags AS text,"
. " 'Support Info' AS section,"
. " CONCAT('index.php?option=com_comprofiler&task=userProfile&user=',id) AS href,"
. " '2' AS browsernav"
. " FROM #_comprofiler"
. " WHERE firstname LIKE '%$text%' OR cb_tags LIKE '%$text% OR cb_primarysupportcode LIKE '%$text%'"
. " ORDER BY firstname"
);
return $database->loadObjectList();
}
?>
Attachment cb_searchbot.zip not found