Active
Project:
User Import
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 May 2009 at 16:19 UTC
Updated:
10 Feb 2017 at 11:16 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ajayg commentedOk so far I figured I need to add following to user_user_import_pre_save function in the case UPDATE_REPLACE section.
"SOMETHING" needs to be an integer (seconds since epoch) to represent when the account was created. However I don't know how to get the value of the field from imported file. In otherwords if there a column #6 called ctime which has this value how do i get inside user_user_import_pre_save function? I already tried
with no luck. ctime column is integer so $fields['user']['ctime'][0] won't work.
I am trying to import user list exported from discusware databse into drupal.
Comment #2
ajayg commentedI think I made further progress but still no luck
I modifiled function user_user_import_form_field_match inside supported/user.inc and added
$options['user']['created'] = t('Created on*');This allowed me a new option to show up "Created on*"under field_match. That I matched up with csv field column.
And I also Changed the above line (first comment) so that "SOMETHING" becomes $fields['user']['created']
Still no luck.
Comment #3
ajayg commentedOk I finally figured this out.
1. Modify function user_user_import_form_field_match inside supported/user.inc. Add
This will show the option to map registration (account creation) date to field in CSV file.
2. Modify function user_user_import_data inside supported/user.inc and Add
just before return $value. This will make sure the value is read from csv file and available for processing.
3. Add following to user_user_import_pre_save function in the case: UPDATE_REPLACE section (file :supported/user.inc )
When you create the template make sure you have a mapping created for 'Created on" field.
This will import the registration date.
Comment #4
ajayg commentedComment #5
nemchenk commentedHere's a patch against CVS HEAD which allows a field from the CSV file to be mapped to $user['create']
Comment #6
nemchenk commentedA slightly better patch, again against HEAD. Now assumes the dates will be coming in as a timestamp, and also sets the creation date to time() as a default.
Comment #7
rsaddington commentedI have this same requirement, plus support for migrating:
Attached patch does this, needs fully testing.
Happy to put this into another issue if required.
Comment #8
rsaddington commentedComment #9
rsaddington commentedComment #10
chirale commentedNice patch boxfresh! It works fine.
Since I'm importing users from an external source, I like the
strtotime()use intouser_created_date.patch(first patch) instead of simple assuming that date is specified in unix timestamp (drupal-to-drupal).Is it possible to preserve both using two different options like Date created (as timestamp) and Date created (as string)? This could be useful even on Drupal, if users are exported from a view that expose dates as strings.
Comment #11
cyberwolf commentedSubscribing.
The language option was actually asked before in 2007, see #107500: Language Support. Nice to see a patch finally!
Comment #12
ryan_courtnage commentedI do think that adding support for user language and timezone to user_import makes perfect sense (and the patch in #7 works, thanks!). "Last access" and "Last login" perhaps satisfy a little bit more of an edge case.
FYI - For those wishing to add something that user_import doesn't support natively , you can implement it's hooks from a custom module. For example, the following would add support for language to vanilla user_import.module:
Comment #13
ryan_courtnage commentedAlso required if you are trying to send notification emails in the user's preferred language:
#1267352: Not passing message['language'] to _user_mail_text()
Comment #14
rooby commentedSince there has been no action for so long, changing to D7 and updating the original post.
It can be backported later.
We should account for all the columns in the users database table. The module is not useful for drupal to drupal imports otherwise.
For example, look at the fields that can be exported from the Profile CSV.
This is important becase a common use case is importing users from an existing drupal site, from the same or a different major version.
Comment #14.0
rooby commentedAdding a more detailed description of what the issue is actually about.
Comment #15
schifazl commentedI'm really interested in this functionality, especially for the user's language!
Comment #16
abaier commentedI would be interested in the status of this issue. Will development for d7 go on or are there any plans of porting this to d8?
Thanks in advance.
Comment #17
abaier commentedI tried the solution for language integration mentioned in #12 and it seems to work well.
The only thing is that I get the following watchdog messages:
Does anybody know where to look for a fix? Unfortunately this would go to far for my php skills.
Thanks in advance for any help!