Updating to 4.7

gte451f - May 30, 2006 - 18:41
Project:User Search
Version:HEAD
Component:User interface
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description

HI,

I made an attempt at updating this module and have run into some trouble.

I can update several of the form elements that are specified individually but I get stuck when running into something like this....

        foreach($profile_fields as $profile_field) {

            $field_row[] = array(
                array("data" => check_plain($profile_field->title), "align" => 'left'),
                array("data" => form_checkbox('', 'user_search_form][' . $profile_field->fid, 1, check_plain($form_values['user_search_form'][$profile_field->fid]) ), 'align' => 'center'),
            );

        }

        $fields_table = theme('table', $fields_header, $field_row);

How to take the form_checkbox and convert it to the new version?

Lullabots form updatetor doesn't read it in correctly and the dynamic nature of the form element is difficult to follow.

#1

Robert Castelo - May 30, 2006 - 19:04

It's not that difficult, load the data into the form, then convert the data into a table in a theme function. Here's a table example from another module:

function theme_user_import_settings($form) {

$header = array(t('csv column'), t('Drupal fields'), t('username'), t('abbreviate'));

foreach (element_children($form['field_match']) as $key) {
$rows[] = array(
form_render($form['field_match'][$key]['csv']),
form_render($form['field_match'][$key]['field_match']),
form_render($form['field_match'][$key]['username']),
form_render($form['field_match'][$key]['abbreviate']),
);
}

$form['field_match']['#value'] = theme('table', $header, $rows);

$output .= form_render($form['options']);
$output .= form_render($form);
return $output;
}

#2

mathmeye - June 1, 2006 - 06:31
Category:feature request» task

i have been in contact with robert, worked on a 4.7 update as well and have experienced the same difficulties.

to render forms in a table, i have moved the form definitions from the theme_configuration_*_form() function to configuration_*_form(). then, in the theme function you simply do a form_render() as robert pointed out.

you will run into more difficulties when trying to place that table into a fieldset as it has been done for the 4.6 version. naming of the forms for placing them in fieldsets according to their profile field category will become an issue as well. i have tackled both of this issues and am willing to share my workarounds. how would you feel about a collaboration of efforts?

i have working version on my local system, however i am hesitant to attach it here since tehre are a couple out issues that need to be addressed and i would like to ask robert first in order to avoid flooding this thread with a multitude of several porting efforts. once i have worked out these issues with robert i will post.

feel free to contact me privately if you would like to see what i have done so far.

mathias

#3

bluecobalt - June 6, 2006 - 02:13

Hey Guys,

Any progress on a 4.7 version? I need this module for a community site I'm working on.

Thanks for the work on it.

blue

#4

zilles - June 9, 2006 - 23:06

mathmeye, I'm also interested in working with you on this. You don't seem to have your contact form enabled on this site. Please contact me.

#5

DaveNotik - June 12, 2006 - 22:18

mathmeye, can you share where you're at so that others can help move the ball forward?

This is something I need as well. Robert directed me here.

Where are we at and how can we get this upgraded to 4.7?

--D

#6

robert_p_levy - June 14, 2006 - 14:56

Hi,

I'm also very interested in seeing what's done so far on the 4.7 version of user_search. Where can I take a look? Thanks,
\Rob

#7

DaveNotik - June 15, 2006 - 06:22

Seems this dude is not around, and not able to be contacted.

Robert, what do you suggest? Have anything more recent so the rest of us can take a crack at this ourselves?

Anyone else capable of updating this thing for 4.7?

--D

#8

mathmeye - June 15, 2006 - 13:42
Title:Update to 4.7» preliminary version

since interest seems to have increased i'll post a preliminary version here. note that this version still has some issues:

- groups: in the configuration results. if a user does not enter any fields to group and then hits the save button, groups will be an empty array. next time results configuration is shown, the fields are gone and there's no way for the user entering grouping information.

suggestions and feedback are of course also welcome.

AttachmentSize
user_search.zip 16.28 KB

#9

DaveNotik - June 15, 2006 - 17:51
Title:preliminary version» Updating to 4.7

#10

mathmeye - June 28, 2006 - 16:32

here is a new version of user_search for 4.7. as alwasy there's good news and bad news:

+ all in all this should be pretty functional now
- it depends on a modified version of the profile.module (included in archive)

let me quickly explain the two reasons for this dependency:

1. wouldn't it be great if you had more search options for date fields? ie. search any user that is born befor/after the specified date. in order for this to work on with mysql, the way dates for profile fields are entered into the database had to be changed slightly (always use two digits for days and months). 

2. wouldn't it be great if you could create vocabulary based profile fields and search for them? i think so, hence the altered profile moule.

the user_search.module still may have some glitched, please let me know. feedback always appreciated. also profile.module is not finalized, the driving force behind those modifications is james nesbitt, hence please all the thanks to him, criticism to me ;-)

AttachmentSize
user_search_20060628.zip 26.31 KB

#11

mathmeye - June 28, 2006 - 16:38

sorry, forgot... while user_search does not create any databases or alter data, this version of profile.module will alter the profile_values table (data is serialized, date format changed) only use this module for testing purposes or if you know what you are doing! i do not take any responsibility for users damaging their profile fields due to the use of these modules!

#12

DaveNotik - June 28, 2006 - 21:00

Thanks for the update! Testing it in a staging environment right now, and I'll report back.

I subscribed to notifications on this module's issues, and I recommend other active participants do as well.

--D

#13

DaveNotik - June 28, 2006 - 22:26

I do a basic search at search/user and get the SQL query string outputted at the top of the page -- debug output? Can't display any users in search results -- it looked like it found users, since I didn't get the "No users where found." mispelled error message, but just showed a weird table with nothing in it, code of which is below:

<!-- begin content --><table id="user-search">
<tbody>
<tr class="odd"><td align="center" rowspan="1" class="picture-cell">&nbsp;</td> </tr>
<tr class="even"><td align="center" rowspan="1" class="picture-cell">&nbsp;</td> </tr>
</tbody></table>
<!-- end content -->

I even uploaded the new profile.module, but where does the db mod you mentioned get done? No updates to run at update.php, etc...

Further, it seems there are no user_search permissions showing on the access control page in Drupal.

Using 4.7.2. Ideas?

--D

#14

mathmeye - June 29, 2006 - 07:38

thanks for the testing. trying to address your issues

> SQL query string outputted

yes, sorry for that, debug output, look for vprintf (line 223) and comment it out. 

> search results

have you configured what user_search is to show in admin/settings/user_search/results? my guess is that you first have no user pictures (hence the placeholder space in your output) and on top of that not configures and fields to display. empty output is therefore normal behaviour.

> profile.module

i am aware that this is not the most ideal case to base user_search on a modified version of profile.module, yet i have explained the benefits (multiple selections are another which i'm working on...). indeed there's no update script at the moment. values should be updated when loading the profile field and saving again. proper update procedure needs to be worked on.

> permissions

user_search borrows existing permissions to grant access. access to the search interface is granted to users with permission to access user profiles (or administer users), access to administration is granted to users with administer search permission.

hope that answers your questions, feedback and suggestions always appreciated

#15

mathmeye - June 29, 2006 - 15:00

new snapshot with debug output disable and other glitches fixed

+ in conjunction with the included profile.module, multiple selects are now possible
+ short help text
+ in results display label field may be omitted to display a spanning title for example
- pagination does not work (yet)

to reapeat, be aware that the included version of profile.module will alter your profile data! do not use this module if you are not aware of the consequences!

AttachmentSize
user_search_20060629.zip 26.76 KB

#16

DaveNotik - June 29, 2006 - 19:55

Using the latest files you posted.

I can see a picture in my search results if the profile has a picture, but I can't get the name to appear even though I configured it appropriately in the "configure results" tab in user_search settings. I made sure I had values in those fields, too, and even updated my profile. Ideas?

Separately, if I allow 200x200 pictures in user profiles, how do I make it so that the search results show a smaller version of the picture? This in combination with another image manipulation module, or...?

Mathias, you have an IRC nick or a way to direct chat? It'd be great to work with you on this.

#17

DaveNotik - June 29, 2006 - 20:51

Your new profile.module messes up the user list (at www.example.com/profile) so my custom profile fields weren't showing. I had to bring back the regular profile.module to get those fields to show up. You might want to look into that.

Also, I I think noticed the country list selection for advanced user search field didn't show the country values I have in there.

And, Mathias, have you considered Views (http://www.drupal.org/project/views)? If a views_profile.inc was created which exposed the profile fields, Views could be used to create the display and it would even handle per-field search if the right filters were exposed.

And I was just informed of this, too: http://drupal.org/node/28325#comment-77255

Looks very interesting. I'll keep reporting back.

#18

mathmeye - June 30, 2006 - 09:08

dave, i'm sorry for the issues you're encountering. unfortunately i fail to reproduce most of your problems. i'll try to address some points anyway:

> [...] but I can't get the name to appear 
there's a label and a grouping field. can you see the label or any text which ist not a profile field placeholder (%profile_fieldname) in the output? the original author has chosen to display the label in white which can hardly be seen on a bright table background, go the the user_search.css file to edit that. any text not referring to a profile field should display. as i said, i'm not having any problems with this. if you're inclined to investigate, you may add some debug uot in the theme_user_search_results() function.

> [...] how do I make it so that the search results show a smaller version of the picture
at the moment this is not possible at the moment. quick solution would be to hardcode the height of the picture and displaying it smaller even though the original file is loaded. more elegant would be to have a user configurable size (ind the configure results tab) with image processing to scale the picture on the fly. to be honest this is not first priority for me at the moment.

> Your new profile.module messes up the user list (at www.example.com/profile
doesn't do that in my case. all fields that i have chosen to show up in contact forms, do so as expected.

> the country list selection for advanced user search field didn't show the country values
most likely profile hasn't updated the field correctly. would you mind editing the profile field again? as i repeatedly said: be aware, this changes your profile_values data!

> have you considered Views
i know of the existence of the excellent views module and have created simple views myself but am by no means an expert. your idea sounds very interesting indeed.

bottom line for me is that there seems to be great interest in a better handling of user related data and search options, yet the approaches differ. i have looked into civicrm, profileplus and others bit settled with this combination of profile and user_search. please not that i'm not the original author of neither module.

ideally, the drupal community would settle on one common solution with 4.8 seeing a better profile module and user search. i am highly interested to bundle the efforts, yet finding a solution that suits everyone is problematic (one big grief is searching of dates...). what do you think needs to be done to get the best out of that for everyone? 

#19

Robert Castelo - July 1, 2006 - 16:08

What about creating a shadow table of profile date fields and storing dates as timestamps?

We should at all costs avoid hacking core Drupal modules.

#20

xamox - July 10, 2006 - 21:43

Man I am jonesin' for the 4.7 release. Keep up the great work everyone!

#21

mathmeye - July 11, 2006 - 21:09

i have looked at the possibility to write a views_profile.inc file as suggested by DaveNotik in this thread. a first attempt can be found at http://drupal.org/node/73245. let me know your thoughts...

i agree that hacking of the core module is not a good idea in general. date handling is still a grieve and timestamps will not solve it for dates before 1970. i'm still trying to find the best solution there. the above mentioned extension to the views module uses yet another method to do date arithmetics, feedback on this approach is of course welcome.

#22

specialt - July 25, 2006 - 18:56

Hi, I have managed to get user_search working with a user_search_results.tpl file for displaying the results with css. But I can't get results from single-line textfields and list-selections to show. I did a var_dump($results) and get all the multi-line textfields showing as well as the username and date which I'm showing as age with a snippet. The single-line/list selections are showing as null. However, I can still search for all those from london (single-line textfield) and get the correct results, although I don't get London to show in the results. Can you shed some light on this? Also, I'm having a problem Dave had with the country list selection showing as empty in the search page. Finally, I was wondering if there would be a way to implement a search by age+ feature that is derived from the dob field.

#23

mathmeye - July 26, 2006 - 07:42

i'll try to look into this. in the meantime you are also encouraged to use the views_profile implementation mentioned here.

date searching is a pain but i think i found a way how it should be possible to do <, <=, ==, =>, > searches, will post once i find the time to implement.

#24

xamox - August 7, 2006 - 19:06

thanks mathmeye, your patch above is working for me. :)

#25

dado - August 28, 2006 - 17:39

The more I read on searching user profile fields in Drupal 4.7.3 the more I get confused. There are patches here, a views implementation, and the new nodeprofile module. I tried the latter and it seems a bit complex. I like the profile.module and would like to make its fields searchable. Any updates as to how to achieve this? Thanks

#26

kingnoc - September 6, 2006 - 01:06

I too am confused. I have looked into almost all of the "profile searching" patches and modules on drupal.org but now I am getting lost... With this particular module, do I understand correctly that user_search_20060629.zip should be used along with the views_profile implementation in order to achieve searching of profiles by their various fields?

If that is correct, since we have to replace our original profile.module file, do we need to re-create our custom profile fields as well?

Thanks for any help with this. I think this feature has a pretty hefty demand with the community, but it's efforts are not concentrated enough to get a solid module created that meets all needs.

#27

xamox - September 6, 2006 - 18:49

Actually I have switched to the views profile(http://drupal.org/node/73245). What you do is put that views_profile.inc into your views module dir(or what it states in the directions). Then all it does it list all the custom fields you create in the list when using the views module. So what you do is create a view, add the nodes you want, for example I have a custom field "Age" in my profile, then you add that, add the node: published filter, along with whatever filters you need. Then when you use that view to search, it will search across those fields. If you don't know how to use the views module I suggest that you learn. It is a very very useful module and the amount of time you would take to learn it will greatly save you time in the future. Another module that works really well in conjunction with views is the panels module, which is used for controlling where things are displayed on the screen.

#28

dado - September 7, 2006 - 14:34

I am familiar w/ views. From my perspective the problem is the native search functionality (which I do not want to do away with) has a misleading "search users" area, which will not find a user even when the search term is that user's last name (a custom profile field for my site). So there is the false impression that the user does not exist.

I would like that native user search to be replaced with a version that actually searches all profile fields. Being able to generate views that include user profiles seems to be an important but separate need.

#29

DaveNotik - September 7, 2006 - 17:20

I have the same problem you do -- custom profile fields are not searchable via the standard user search. (I do also have the issue of creating nice lists of users w/ custom profile data.)

Usernode (http://drupal.org/project/usernode) in combination w/ Views is a possible solution. I got it to work, but not quite like I wanted it to. I'll report more when I get back to that stuff.

Of course, please update this thread w/ your own findings. It's really something I'd love to nail down.

#30

ryansdwilson - September 23, 2006 - 16:55

Just as something to throw out there, if someone can put a fixed price together and can complete the work in a timely fashion, i'd be willing to pay a bounty. I'm looking for the /search/profile node to be extended so that when the user expands advanced search the are able to filter by any of the custom profile fields. If you're confident you can code such an addition and willing to be paid to contribute to drupal, contact me at email@ryanwilson.com. This offer will be open for 10 days from the time of this post.

#31

Rosamunda - October 5, 2006 - 22:40

I´m sorry, but I´m a bit lost here... can anyone please put the 4.7 zip file if it exists?
I´ve tried the patches and stuff, but nothing seems to work for me... I get this nasty error:

Fatal error: Call to undefined function: form_checkbox() in /home/listastop/public_html/drupaltest/modules/user_search/user_search.module on line 488

Thanks!!!

Rosamunda

#32

sime - October 6, 2006 - 05:34

When I tried user_search at #8, my basic search had about 20 joins in it which wasn't really doing it for me. So I hacked an extremely simplified version of user_search.module that runs on 4.7.

When you install it, please go to administer » profile search and enter a search term. The search will return a list of users where the search term is found in the username, email address, or any profile fields for the user.

You won't see an advanced search with this module, so don't look. ;-)

AttachmentSize
user_search.module 4.13 KB

#33

sime - October 9, 2006 - 08:46

fixed bug in prev attachment - replace user_search.module with this new code.

AttachmentSize
user_search2.module 4 KB

#34

kingnoc - October 17, 2006 - 01:15

I am currently using user_search along with views_profile.inc (which is now included as part of core views release). It works well except for the results:

I am trying to clean up how the results are displayed using CSS, but I cannot seem to target the results properly. It seems as if the results are output as one giant table instead of seperating each user into it's own container. Without this, it's really impossible to insert breathing room between each user listed in the results.

Also regarding #32 and #33 by sime; what's my incentive to use your update? Maybe I am not drupal-savvy enough to figure out what you've done, but I am not sure what you improved.

Thanks!

#35

sime - October 17, 2006 - 04:55

Hi kingnoc. Assuming that we are comparing my version to mathmeye's version. My version has:

1) simplified SQL (much faster for some sites)
2) no advanced search (not a worry for me, might worry some)
3) less code (easier for me to maintain)
4) slightly different results list (name & email from memory)

Cheers
.s

#36

sime - October 17, 2006 - 04:57

Oh, and I should clarify that if you already have user_search working for you, my code will offer *no* additional value. :-)

#37

tain - June 20, 2007 - 18:38

@sime: I tried your version, but it didn't work for me. No "profile search" under admin menu, and going to the path (as indicated in the code) didn't do anything. My search results didn't change at all.

Thanks for the effort, though.

#38

Robert Castelo - July 13, 2007 - 14:38

I've switched to using Node Profile module, which means profiles can be searched the way that any other content can be.

The bad news is I won't be working on this module any more - the good news is that I'm working on tools to export profile data out of Drupal and import it back in as a node profile.

Anyone who want to adopt this module and carry on working on it is very welcome to it.

 
 

Drupal is a registered trademark of Dries Buytaert.