profile search

17 years 10 months ago #14582 by lmcguire
Replied by lmcguire on topic Re:profile search
tngenewhiz wrote:

I am really new at customizing the code for components, modules, and bots. I tried to follow your very clear instructions, but the bot doesn't work for me.

I only want three fields searchable: name, city, and researchinterests (a CB custom field I created). So, I edited lines 64-77 as follows:

// customize this query to show your results and specify search fields as desired
$query = "SELECT a.name AS title,"
. "\n CONCAT_WS( ', ', a.name, b.city,b.cb_researchinterests ) AS text,"
. "\n '' AS created,"
. "\n '' AS section,"
. "\n '2' AS browsernav,"
. "\n CONCAT( 'index.php?option=com_comprofiler&task=userProfile&user=', a.id ) AS href"
. "\n FROM #__users AS a"
. "\n INNER JOIN #__comprofiler AS b ON b.user_id = a.id"
. "\n WHERE ( a.name LIKE '%$text%'"
. "\n OR b.city LIKE '%$text%'"
. "\n OR b.cb_researchinterests LIKE '%$text%' )"
. "\n GROUP BY a.id"
. "\n ORDER BY $order"

I wasn't sure if the new bot makes profiles searchable through the default public search (NOT what I want) or through the profile search box in the CB component. It didn't work either way. When I logged in and did a profile search for a word that I know is in the cb_researchinterests field of my profile, I got no results.

So, I'd be grateful for any assistance someone can give me.


My bot is for the default public search, not the CB search box - to modify that, I'm pretty sure you'd have to modify the code that comes with CB.

As for the search itself, I can't find 'city' as a field in jos_comprofiler - if you created it, I'm pretty sure the field name would be cb_city. Other than that, I can't think what might be wrong. I'd recommend trying the query in MySQL Query Browser to see if you can get it to work, then plugging it back into the PHP.

Sorry again for the delay...

Liz

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.252 seconds

Facebook Twitter LinkedIn