My site exists as a community site that allows people to find each other based on all kinds of criteria. Obviously, I'm going to make very in depth profiles for them, but once the profiles are there, how can I create a kind of "advanced user search" so that they can search based on items in the profiles?

Or am I simply not seeing where it is?

I have plenty of coding experience if that makes a difference.

Comments

blarg’s picture

So shall I start writing a custom module or?

sepeck’s picture

You could turn on the profile module.
http://drupal.org/handbook/modules/profile

http://drupal.org/profile/interest/theme

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

blarg’s picture

I have the profile module turned on already.

I'd like to be able to display a search box (preferrably a block) that basically says:

I am a ()man ()woman
Interested in ()man ()woman
Between | 18 | and | 22 | years old
That lives in | Managua |

etc.

This would search the info in their profiles and display a list of members that match the criteria.

robert castelo’s picture

I'm planning on writing a user search page module which will allow searches on profile field data. Includind combined searches on multiple fields.

Maybe we could collaborate on this. send me an email through my contact tab.

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

blarg’s picture

Awesome. I sent you an email.

michalska’s picture

Any estimate how long it will take?

Michal Ehrman
Editor, Boutique
www.boutique.co.il

blarg’s picture

He's still working on it, but at this point there's already search capability. I've done absolutely zilch, so it's all him. :-)

robert castelo’s picture

Now available here.

This is an ALPHA release - feature incomplete, possibly buggy, and potentialy insecure. Don't use it on a live site. I've put this into projects so other developers can collaborate with me to get it finished.

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

robert castelo’s picture

Just uploaded a new version to cvs contrib, if you have direct access to cvs get it there, if not wait until tomorrow to get it from the project page.

The new version now displays all profile data properly, e.g. dates, and now passes all data through a profile module function that takes care of security - so should now be as secure as any other profile display page.

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

robert castelo’s picture

* Replaced 'Users' search tab
* 'Search again' option on results page
* Group search fields by profile categories
* Pagination of results

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

robert castelo’s picture

Just posted a new version that displays a checkbox on the search page for checkbox fields, and fixes searching on 'select' type fields.

I think there are enough features for a Beta release.

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

blarg’s picture

This is exactly what I was looking for, with a few feature requests. Perhaps you can point me to where I can hack away and patch for what I want.

1. My site is in Spanish, and strings don't seem to be passing through the localization module. I don't exactly know how the localization module hooks into strings with Drupal, but my guess is that it would simply be time consuming, not hard, to throw there. I'd be happy to do this if that wouldn't just create more work for you to merge with your current code than just doing it yourself. Lemme know.

2. I know this would mean having a table for this in the database, but it'd be awesome to be able to configure which fields are actually visible on the search form. I'd be happy to do this as well.

3. How hard would it be to write a block that hooks into this that you'd configure to have maybe 4 or 5 fields that could basically draw people in much like those personals sites for a quick search? I'd volunteer for this but I wouldn't really know where to start.

robert castelo’s picture

1.) Translation
The search button and user tab can be translated in the locale already.
What else do you want to translate?

2) Settings
Yep, working on this already, for search page and results page(s).

3) Block
Nice idea. I was already thinking this could become 'Views' for users, which would enable what you've suggested. Don't have time to work on that at the moment, hopefully in future.

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

blarg’s picture

On the actual search page, the words AND and OR don't work so well for non-English speakers. ;-)

Also, on the results page, it says "Search again\nNo users were found." I'm pretty sure this isn't going through localization. I can poke around and whine some more if you'd like.

robert castelo’s picture

Now passed through l(), I'll check the rest later.

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

robert castelo’s picture

I've added a settings page:

administration -> settings -> user search

There are controls for which fields are didplayed in search and in results pages.

Also control of how long text textarea fields can display on results pages.

Anyone have time to help write the documentation for all this while I work on getting the code finished?

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

blarg’s picture

I'm on vacation and on an airplane would be a great time to document it all. Is there some kind of standard docs you're supposed to follow? If so, pass me that way and I'll get started.

robert castelo’s picture

Something like this would be great:

example

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

blarg’s picture

That's cake, I'd be happy to. If you plan on changing menu structure or anything let me know in the next few days so I don't have to redo very much if you could. :-)

court-jus’s picture

Your module looks great but doesn't work on my drupal installation (version 4.7); it says :

Fatal error: Call to undefined function: form_textfield() in /var/www/maquette-tm/modules/user_search/user_search.module on line 203

My subject is "would be great to" so I explain :

I use the < a href="http://drupal.org/project/cck">cck module to create specific content type (it's like a kind of catalog) with fields (numeric, boolean, choice list, text...) and I think what you did with the user profile could be done with content type with a little coding. I would like to do that but I don't really know where to begin.

Do you think I have to copy/paste your module, and can you give me the "road to follow" ??

robert castelo’s picture

It's 4.6 only.

Will be updated once it's feature complete, but I need it for a 4.6 site.

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

robert castelo’s picture

Just released a new version which is ready for live use. Let me know what you think:

http://drupal.org/node/58788

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

anupam96’s picture

I want this functionality for version 4.7. Any plans of doing that? Please?

robert castelo’s picture

Yes, there is work being done to create a 4.7 release.

http://drupal.org/node/66332

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

Mojah’s picture

I've added this http://drupal.org/node/67084 module that allows profile filtering allowing you to narrow down the listing of users based on profile fields.

fluitfries’s picture

Just want to save some work for people in the future. There are a few modules being worked on to create a way to search through user profiles. There are also a few hacks, but I am leaving them out of the results. You can find them if you search the forums.

-) Advanced User - http://drupal.org/node/70339
-) Profile Plus - http://drupal.org/node/55469
-) Views Profile - http://drupal.org/node/73245
-) User Search - http://drupal.org/node/66332

Hopefully some or all of the people working on these will come up with a great solution for us!