Users who are created using the User Import module (users imported from a csv file) are appearing more than once in the user list display (for example, imported user John Smith may appear 3 times in the /site_user_list display. I was able to overcome the issue by editing and then saving the user profile. Once this is done the user only appears once in the /site_user_list display. I submitted this bug report assuming the issue is within the user list module, however I am not sure of this (in other words, this may be caused by a bug in the user import module).
Comments
Comment #1
pukku commentedHi! What happens if you rebuild the query/view/table? That is, go to the Site User List configuration screen and click on the link to rebuild? Does that solve the problem?
Ricky
Comment #2
craigdurling commentedRe-building using the link /site_user_list/rebuild does not do change the data displayed in the table. Do you have any other ideas?
Comment #3
pukku commentedDo you have any kind of direct access to the database? If you are using a view or a table, could you look at that table (`site_user_list_table` or `site_user_list_view`) and see if the duplication exists there? If so, could you check the `users` table and see if there is duplication there?
Thanks,
Ricky
Comment #4
craigdurling commentedThere is no table with either of those names. The only table present that seems to relate to this module is called 'site_user_list_fields' and I don't think that's what you are looking for.
Comment #5
pukku commentedOn admin/settings/site_user_list, do you "Retrieve data" from a query, view, or table?
Comment #6
craigdurling commentedThe option selected is "subselect query". The option view is not available (I only see subselect query and table as options).
Comment #7
pukku commentedHi! Under the "result" section of that page, there is an option to "Display the SQL Query". Could you check that option, as well as the "log rebuild actions" option near the top, visit the site user list, and paste in the query that's being run, as well as the entry into the log file for the rebuilt query?
Thanks,
Ricky
Comment #8
ferrangil commentedHey! I'll keep doing that...
This one is my query. I changed to table, so let me see it...
The rows with the info is duplicated in site_user_list_table table. As I said, the users I created by hand are NOT duplicated. Well, as I "only" need to import 170 users, I could do it by hand, but I want to know why this is happening and try to solve the problem!
I now changed the settings to subselect query and the result is still the same. And the table was dropped from the DB. The query, in that case, is:
My users table is NOT duplicated, even for the users I created with node_import.
The table profile_values seems to be ok. No duplicated uid or fields.
What else?
Mmmh... if the users table is not duplicated, and also the profile_values seems to be ok... one may think the problem is with Site User List module, because is the one that is creating the site_user_list_table or the subselect query... but not, because not ALL users are being duplicated... just the ones that had been imported with User_import... so, User_import is (still) the bad guy! ;)
Comment #9
pukku commentedOk, do you have direct access to your database (your comments imply that you do)?
If so, can you run the following queries and send me the results?
Thanks!
Ricky
Comment #10
pukku commentedBlarg! Sorry, there was a typo there.
Try this:
Comment #11
ferrangil commentedThe first one, lists all the uid, with no duplicates (but as we are adding Distinct... that's normal..)
The second one looks bad.
Something like:
0 Spain
1 UK
2 UK
(and then, the duplicates starts, because I just have these 3 users before using user_import).
3
3 UK
4
4 France
...
...
How does it look??
Comment #12
ferrangil commentedUps... posted twice...
Comment #13
pukku commentedHm. Is there anything in the 'datainici' column?
What happens with the following query?
If this returns weird results, then also run the following query, paying special attention to the number of rows reported to be returned:
(Or substitute some other UID that actually exists.)
Thanks,
Ricky
Comment #14
ferrangil commentedFirst one looks like:
And the second one, just prints
No, datainici was suposed to import a date field, but as my input format was "wrong", it's empty. As I'm still testing, I forget to re-import the users with a compatible date, so now it's empty.
Comment #15
ferrangil commentedIt looks like the Country field is twice for the imported users: Once good, once empty.
returns
More info:
SELECT * FROM profile_fields p where fid=8returns
The country field type is "list selection" (not just a single-line textfield).
I'll keep looking at that tomorrow...
Thanks!
Comment #16
pukku commentedSo the issue is that there is an extra row with the blank (null? empty string?) value in it.
Is the 'country' field supposed to be a multi-select field — that is, should people be able to select multiple values? (Is it a select field in the first place, or is it a text field?)
Try the following queries:
(This is to determine if the missing value is null or the empty string).
Then, back up your database and try the following:
WARNING: this will change your database; I don't know what the results will be; make a backup first!
(If in the previous round of queries, you got a count for the
is nullvariant, then that last line should beAND value is null)See if that solves the problem.
(Note: if you have other fields that have the same problem, you many need to run the query changing
fidas appropriate.)HTH,
Ricky
Comment #17
ferrangil commentedSolved ;)
But this doesn't fix the bug...
My country field is a select field, with NO multiple values.
Your queries were a bit wrong (profile_fields should be profile_values).
My duplicates were an empty string, so I used
and now my Site User List works great, no duplicates at all.
It's quite easy to fix that, but we should try to find the bug (and solve it) or, at least, write a big note in the project page (in the User_import project page)..
Thanks, Ricky.
Comment #18
pukku commentedHi! Sorry about the bad queries -- I'm glad you caught the error.
Ricky
Comment #19
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #20
davidwhthomas commentedFor 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 it inserts a blank record 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 in:
/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.
Comment #21
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #22
pdelsignore commentedAMAZING!
dude you just saved me hours of work, as I have to import hundreds of users and the views incompatibility was creating a huge problem... I would have had to manually re-save profiles or write a script to do that.
THANKS!!!!!
Comment #23
esadot commentedI second. Thanks a million. Also, i was wondering if there is a plan in place to permanently fix it.