Very cool module. I was looking for a module to enable me to search for Drupal users based on user profile criteron and finder on a view of users seems to be the ticket for me.
Question, I want to add many fields from the user profile to my finder form and allow the user to AND them to together to located the users he wants. However, likely only some of the criteron will be used in any given search and the reminder should be ignored in the search. I see that checkboxes have an 'add empty item to top/bottom of list'. Does that mean that field will be ignored in the search?
Also I was haveing trouble getting a test field to be ignored in search as well. Well I entered a value it found all the users in the view with the value. However, when the field was blank, it returned no user records when I was hoping it would return all user records.
Thanks for any help.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | finder-6.x-1.7-views-empty-keyword.patch | 539 bytes | rwd |
Comments
Comment #1
danielb commentedYes. Or if they don't check/select/type anything.
I have heard another user mention that 'anding' stuff together made the empty value NOT ignored. If you find that to be the case, please let me know and I can look into it.
Comment #2
danielb commentedYup I can confirm this last statement, it will need to be a feature added specially
Comment #3
webservant316 commentedAre you saying that this feature needs to be added to the module?
Or that I need to configure my finder view properly the ignore blank fields that are ANDed together?
Comment #4
danielb commentedfeature, hence why I said feature and changed the category to feature
Comment #5
webservant316 commentedAny ETA on that?
Your module seems to be the only one available that is smart enough to present an search form based on whatever user profile fields are available through the views modules so that I can search for users ANDing together various profile fields.
Comment #6
rwd commentedI encountered what sounds like the same issue with:
The issue appears to be that when the CCK text field is empty, Drupal sets it to NULL in the database, but Finder is running an SQL query like
... WHERE field_foo_bar LIKE '%%' ..., which excludes NULL values for field_foo_bar, and seems like a redundant clause anyway.Replacing line 382 in finder_views.module with the following code (less the PHP demarcation tags) fixes this specific issue:
if (empty($keyword_array) || ((count($keyword_array) == 1) && (array_pop(array_values($keyword_array)) === ''))) {This is also attached as a patch for finder_views in 6.x-1.7. Could someone who knows this module better than I advise whether this is likely to have any adverse side-affects, and if not, whether similar logic needs to be applied elsewhere in Finder.
Comment #7
danielb commentedGood job richardwdoe, it's good to see someone doing a bit of investigating on their use-case. It's unlikely you'll need to make this change elsewhere (unless CCK features are specifically implemented in to finder_node at some stage, but currently they are not). Thanks for explaining the reasons behind it too.
Comment #8
danielb commentedI've also found some code like "if (!empty($keyword_array)) {" in finder_find_query in finder.module which would need to be changed too? Won't affect you if you're only using a Views finder, but I will have to change it there too.
I'm thinking of adding a line before these calls to empty to clean out keywords we consider equivalent to empty. Will need a callback because the default behaviour of array_filter() would remove too much I think.
Comment #9
danielb commentedI have added this to my local copy and so far it looks good, I will commit it eventually
Comment #10
danielb commentedhmm there seems to be a bug somewhere
Comment #11
danielb commentedalright I think she's good now