Closed (fixed)
Project:
User Import
Version:
5.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Aug 2007 at 13:20 UTC
Updated:
2 Dec 2010 at 00:13 UTC
Jump to comment: Most recent file
Comments
Comment #1
mandclu commentedThe attached file allows for a column to be specified which has a comma separated list of roles. It also provides an option to add roles that are specified if they don't already exist. It will preserve any existing roles, including those that might be specified to add to all imported users.
Unfortunately, because user_import relies on module_invoke_all to call additional functions, I had to name the functions in line with a module, and there is no module for roles. I chose to use system, which is admittedly kind of an ugly solution. It might be better to change this so that it is included in user.inc or user_import.inc, but until there's commitment to include this in the overall project, I wanted to keep the code separate. I'd be happy to adapt the code if there is interest in adding this to the project.
Comment #2
mrvinceo commentedI am attempting to implement the fix as provided by surge_martin, above for use in an E-learning site, but having trouble getting this to work in Drupal 6. The field is visible in the column mapping screen, but the following error appears after the import and no roles have been mapped or created:
warning: array_push() [function.array-push]: First argument should be an array in /homepages/14/d294720235/htdocs/modules/user/user.module on line 249.
I'm a noob when it comes to php, so I'm hoping a fix for this might be quite obvious to somebody out there.
Comment #3
nemchenk commentedInteresting. I'm using Drupal 6.13 and user_import 6.x-1.2 and it doesn't seem to be parsing system.inc. Yours seems to be working, mrvinceo, where did you drop the file?
Comment #4
nemchenk commentedAnswered my own question, I think: modules/user_import/supported/ gets the file to parse.
When I run an import, however, I am not getting any errors: the users go into the DB, but don't get any roles set.
Comment #5
nemchenk commentedOk, I've got this working -- the signature for function system_user_import_data() had changed at some point since surge_martin had written the modifications, and just needed to be updated. The attached file works if you drop it into modules/user_import/supported/ on Drupal 6.13 and user_import 6.x-1.2
Comment #6
mrvinceo commentedFantastic! nemcheck; you are a star, works perfectly now and is exactly what we needed to get the whole project off the ground. As for me, back to studying basic php!
Cheers again.
Comment #7
robert castelo commentedPatch re-written and committed to User Import 6.x-1.3.
Will backport to User Import 5.x in near future.
Comment #8
nemchenk commentedThanks, mrvinceo! :) And thanks to Robert Castelo for the quick turn-around on the release!
Comment #9
robert castelo commentedFixed in user_import 5.x-2.9 for the Drupal 5 version.
Comment #11
timd.mackey commentedI cannot figure out how to specify roles for imported users via csv....
Edit: sorry, my question was answered in http://drupal.org/node/982006