Drupal 4.6.5

Dear All,

I've created a fair number of custom user profile fields using the profile module, comprising mainly drop-down boxes and checkboxes. What is the best way to implement a user search facility, whereby the user navigates to a "search members" page, and is presented with controls for interrogating a combination of the custom fields? For example, a search could be made for all members who live in the United Kingdom, speak French and enjoy walking and those members who match the search criteria would then listed.

Any suggestions would be most welcome as I don't really know where to start.

Comments

edrupalec’s picture

assume you mean you used profile module not flexinode?
-----
Drupal ecommerce, at http://www.drupalecommerce.com is a new site written using language that Drupal beginners and intermediate users can understand. Quick links to "Modules" and "Module Groupings."

stretchwickster’s picture

Yes I used the profile module.

PAAHCweb’s picture

Whoa! No default profile search? My client requires it. With all the descriptors attached to the profile node, I assumed they would be searchable.

I was just about to create the custom user profiles. If I use a custom flexinode, will they be searchable without installing an extra module?

TIA,
D. Lynn

robert castelo’s picture

I'm working on a module that enables profile searches:

http://drupal.org/node/58788

It's still at a Beta stage, the features are there, and searching works - now I'm sorting out the way results are displayed.

Cortext Communications
Drupal Themes & Modules

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

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

stretchwickster’s picture

That sounds good. I'll have to try that out.

edrupalec’s picture

nice. will you be doing 4.7 also?
-----
Drupal ecommerce, at http://www.drupalecommerce.com is a new site written using language that Drupal beginners and intermediate users can understand. Quick links to "Modules" and "Module Groupings."

robert castelo’s picture

Yes, will evetually get ported to 4.7, but for the moment I need this for some 4.6 sites.

Cortext Communications
Drupal Themes & Modules

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

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

edrupalec’s picture

great. thanks.
-----
Drupal ecommerce, at http://www.drupalecommerce.com is a new site written using language that Drupal beginners and intermediate users can understand. Quick links to "Modules" and "Module Groupings."

stretchwickster’s picture

Robert, it looks like your user_search module is what I'm looking for. In order to run some test searches, is there a quick way to create dummy users because you need a separate email account for each one?

robert castelo’s picture

I think the developer module has a function to create test users.

Cortext Communications
Drupal Themes & Modules

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

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

stretchwickster’s picture

...now I'm sorting out the way results are displayed...

Robert, I would be most grateful if you could keep me posted regarding any developments to the display of results.

robert castelo’s picture

Latest version allows control of what search fields and results fields are shown, now working on ordering of fields, on both search and results. After that need to allow for result fields to be concatenated and given a new label - e.g. Name: %first_name %last_name

Cortext Communications
Drupal Themes & Modules

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

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

stretchwickster’s picture

Robert,

On the "configure search form" (url: admin/settings/user_search), there's a group box entitled "Category Order". Inside this group box is a list of profile categories. Unfortunately, only 5 of my 8 categories are displayed.

I've been trying to debug the code in theme_user_search_configure_form but I can't figure it out. $category_count equals 8, which is correct but further down values are stripped out of $sort_order (populated from $form_values) to populate the category list and $sort_order only comprises 5 categories??

Consequently, when I go to do an Advanced User Search, I don't have all the group boxes displayed.

stretchwickster’s picture

Drupal 4.6.5 with a theme derived from bluemarine (xtemplate)

Robert,

I have added a large number of custom user profile fields (about 60) using the profile module and would like to improve the layout of the User Search page. Currently, each fields is displayed on a new line, how would I go about making more efficient use of the screen real estate (e.g. perhaps I could double up the fields so that two appear per line)? What section of which file do I need to edit to effect this change?

Your advice would be much appreciated!

robert castelo’s picture

In the user_search.module look for the line:

function theme_user_search_advanced($profile_fields, $form_values) {

You can style all of the content in that function however you like:

http://drupal.org/node/11811

Cortext Communications
Drupal Themes & Modules

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

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

stretchwickster’s picture

Thanks for that Robert - I'll try editing it later. I'm guessing I need do a series of checks e.g. if field is "Language Spoken" then place that next to "Gender" - is that the correct approach to editing the theme_user_search_advanced function?

I know this isn't your module, but where would I need to look for editing the Registration page fields (see the full question at http://drupal.org/node/67568)?

robert castelo’s picture

User Search module is now available for Drupal 4.6, and being worked on for 4.7....

http://drupal.org/node/58788

Cortext Communications
Drupal Themes & Modules

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

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

stretchwickster’s picture

So does this latest version include the items you mentioned in your post (11 May 2006) in this topic?

robert castelo’s picture

Yes, plus a few other niceties.

Cortext Communications
Drupal Themes & Modules

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

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

edrupalec’s picture

Robert, thank you very much. I'm looking forward to using it. Any idea when 4.7 will be ready? (1 week, 1 month, or beyond?) Do you need 4.7 for one of your sites, or might it get pushed quite far down the list of priorities for you? It sounds like a great module.

Drupal ecommerce, at http://www.drupalecommerce.com
http://www.drupalecommerce.com/troubleshooting
http://www.drupalecommerce.com/modulesexplained
http://www.drupalecommerce.com/47vs46
http://www.drupalecommerce.com/howto

robert castelo’s picture

There's a few people working on it, so hopefully soonish.

I need it towards the end of next month for my sites, so if it's not done in the next few weeks I'll update it myself.

Cortext Communications
Drupal Themes & Modules

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

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

stretchwickster’s picture

Robert,

I just installed your latest User Search module from the link you specified and I get the following 2 errors after clicking the Search button:

"user error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1..."

and

"user error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 5' at line 1..."

I have not reproduced the SQL Query because it gets truncated, as I have 60 custom profile fields.

The page loads underneath these messages and "No users where found" is reported under the "Basic Search" tab. Incidentally, it should be "No users were found".

Please advise.

robert castelo’s picture

Thanks for the feedback, could you create an issue for the module:

http://drupal.org/node/add/project_issue/user_search/bug

I don't have time to work on this at the moment, but when I do I'll be using the bug tracker to look at issues.

Cortext Communications
Drupal Themes & Modules

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

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

stretchwickster’s picture

Ok, will do when I get a chance.

adrianromano’s picture

Has anyone analysed the user_search modules performance implications. From what I can see, the query used to search users does a LEFT JOIN for each field on the profile. So, if I have 50 fields on the user profile, the query does 50 LEFT JOINS with the users table. I am concerned about the performance of this query as number of users, profile fields increase.

Am I better off writing a custom module if my profile fields are fairly constant ?

edrupalec’s picture

that's a good question. Would flexinode would be equivalent in terms of LEFT JOIN, or is one or the other better in terms of this performance issue?

Drupal ecommerce, at http://www.drupalecommerce.com
http://www.drupalecommerce.com/troubleshooting
http://www.drupalecommerce.com/modulesexplained
http://www.drupalecommerce.com/47vs46
http://www.drupalecommerce.com/howto

robert castelo’s picture

Would be great if you could try it out and give us some feedback - number of field, number of users, speed of search.

Go to admin/logs/pages to see 'Average page generation time', or even better install the dev.module and test how long the sql query took.

Cortext Communications
Drupal Themes & Modules

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

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

stretchwickster’s picture

Just for your information, I had been using the cvs version (which I assume is for 4.7.0) of user_search instead of the 4.6.0 version. Now everything works fine - no bugs!

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.

edrupalec’s picture

Thank you. That's great, and it sounds like a useful module. Perhaps you can post a new forum thread letting people know about this module. It's the first I've heard of it but it does something that's often requested.

Drupal ecommerce, at http://www.drupalecommerce.com
http://www.drupalecommerce.com/troubleshooting
http://www.drupalecommerce.com/modulesexplained
http://www.drupalecommerce.com/47vs46
http://www.drupalecommerce.com/howto

craigdurling’s picture

This module is exactly what I'm looking for. Any chance you could modify this module for 4.5? I am reluctant to upgrade my site to 4.6 due to a large number of modifications I've made to 4.5.

Craig

robert castelo’s picture

No chance of a downgrade to 4.5

Try it, it might work anyway.

Cortext Communications
Drupal Themes & Modules

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

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

craigdurling’s picture

Thanks for the suggestion. The 4.6 module didn't work in 4.5. After enabling it, I tried to access the settings page for this module and I was re-directed to an empty (blank) page. Is there anything quick and dirty I could do to hack this module to make it compatible? I ask this because I have no idea on how modules are written or structured.

robert castelo’s picture

Go through this page and do everything in reverse:

http://drupal.org/node/12347

But instead I would highly recomend getting your site updated to 4.6, apart from the extra features, there are also security issues to consider.

Cortext Communications
Drupal Themes & Modules

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

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

PAAHCweb’s picture

This module is very useful, thanks! And the results page looks great, with user picture and link to full profile, everything one would want. :^)

Only one problem, I configured the search form to display only 10 of the 22 user profile fields (and saved the config of course), but all 22 fields are still being listed. Have any idea where I should start looking for the problem?

Version #: 4.6.5.

Thanks,
D. Lynn

robert castelo’s picture

I haven't come across that problem.

Could you create an issue for it and add as much info as you can:

http://drupal.org/node/58788

Cortext Communications
Drupal Themes & Modules

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

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

PAAHCweb’s picture

Hi Robert, have you looked at the issue queue lately? I posted something a couple weeks ago. There are a few related entries there; Stretchwickster and I have done some troubleshooting. We're both having the same problem. Neither of us is ready to upgrade to 4.7 yet, so we hope you will give the 4.6 version a second look.

Appreciatively,
D. Lynn

mbria’s picture

Hi,

First at all: thanks for the module. It looks really promissing... and it's exactly what I was looking for.
Second... does any body know if is planed to be ported to 4.7.2 or if is ported yet? I made some search in drupal.org and I didn't found much information about this issue.

Thanks a lot in advance for your help,

m.

mbria’s picture

I read this same thread in detail and I found you already answered this question in former posts...

Do you need help with the porting? I'm really interested in make it run so I planned to do something similar (with my basic programming skills :-P).

Let me know how I could help with testing and/or programing over 4.7.2.

Cheers,

m.

robert castelo’s picture

Yep, anyone else interested in helping with the 4.7 update go to this thread:

http://drupal.org/node/66332

Cortext Communications
Drupal Themes & Modules

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

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

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!

prateek’s picture

To allow searches by all users, I made few changes to the advanced user module
Can u guys try it out and let me know?
http://drupal.org/node/70339