profile search

14 years 3 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 AS title,"
. "\n CONCAT_WS( ', ',,,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=', ) AS href"
. "\n FROM #__users AS a"
. "\n INNER JOIN #__comprofiler AS b ON b.user_id ="
. "\n WHERE ( LIKE '%$text%'"
. "\n OR LIKE '%$text%'"
. "\n OR b.cb_researchinterests LIKE '%$text%' )"
. "\n GROUP BY"
. "\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...


Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.416 seconds

Facebook Twitter LinkedIn