Hi,
I have enabled Profiles on my site (for alumnis) and added the fields:
- profile_first_name and profile_first_name (category 'Personal info')
- profile_grad_year_high_school and profile_class_year_high_school (category 'School related info').
I then imported some users using a CSV file with the fields username, email, lastname, firstname, graduationyear, class and password.
(There's an error message saying a temporary file could not be deleted in from the tmp directory (\includes\file.inc file on line 468) but I guess this has nothing to do with the problems I experience.)
All the users are imported and all info seems to be okay when I look at the user profiles.
But when I open a View that selects alumnis by year and class, all users appear 4 times!! (Once with last name and first name, once with last name only, once with first name only and once with none of both.)
You can find a screenshot at http://www.pedrotytgat.be/temp/view_1.png
I started looking around in the mysql tables and found that the profile_values table also holds every user 2 times, where each field ID has a filled in and an empty value.
Screenshot at http://www.pedrotytgat.be/temp/profile_values_1.png
I discovered that editing the user profile kind of consolidates things. When I change the first and last name (fields belonging to the category 'Personal info'), two entries disappear in the profile_values table:
See http://www.pedrotytgat.be/temp/profile_values_2.png
Immediately, the View yields the correct result:
See http://www.pedrotytgat.be/temp/view_2.png
Changing the graduation year and class removes the two other redundant fields in the table.
See http://www.pedrotytgat.be/temp/profile_values_3.png
Of course, the View is still correct:
See http://www.pedrotytgat.be/temp/view_3.png
I am using Drupal 5.2, using a local mysql and apache server (using the "portable WOS" application suite).
Thank you for any help,
Pedro
Comments
Comment #1
saviles commentedI am having the same issue, only records are appearing 4 times since I have 4 profile fields. Did you ever resolve this?
Comment #2
ferrangil commentedSome people (also me) with the same problem, but instelad of using Views, using Site User List, but the problem must be when importing...
http://drupal.org/node/198282
Comment #3
ferrangil commentedGuys (and girls??),
I managed to fix that in my case. Please take a look at:
http://drupal.org/node/174322
The bug is still unresolved, but at least you could have your user list without duplicates.
Have fun!
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #5
davidwhthomas commentedThe fix above was specific to that users field ids etc...
For anyone having issues with duplicate entries in the profile_values table for users when using user_import:
I ran some tests and it looks like the issue arises when hook_user is called by the profile module when the user is saved. I don't think it's passed the profile values in the way it expects and so profile_save_profile inserts a blank record into profile_values for that user, along with the one inserted by user_import.
To solve this, I (temporarily) commented out the case 'insert': line in profile_user
To comment out a line, simply add two forward slashes i.e: // in front of the line, converting it to a code comment
/modules/profile/profile.module line 177Remember to uncomment the line when you've finished importing or else the profile module will not work properly
I hope it works for you too.
Note: It would be possible to fix this issue in
user_import.module (version 5.x-1.3)by adding the profile fields to the$accountobject before it is saved withuser_save('', $account); //line 1588That way, the profile module will handle saving the profile fields, avoiding this blank field error.
Comment #6
robert castelo commentedComment #7
robert castelo commentedFixed in 5.x-2.0-beta2.