Back with 4.5.2 I needed a way to Bulk import users accounts AND pre-add data into the custome Profile fields. with the help of the Drupal community I came up with the following, and want to share it with all of you to see if it helps.
Below is the code I run against a CSV (Comma separated variable) file. I commented out the commits so you can use this 1st to test your import run. It checks to see if the username or email is a duplicate or not. That way you can run a PRE-Flight check for you run for real.
Also... you may not need the PROFILE fields... just dont use them.
This script takes their username and creates a password as username123
I then run a different script against the CSV which sends the users a welcome email with their username and password... and instructions to get started.
NOTE: PUT THESE FILES AT YOUR BASE OF YOUR DRUPAL INSTALL
Special thanks to: http://drupal.org/node/9806
Hope this helps....
David McIntosh
neofactor.com
Due to Drupal.org security I cannot post the code here so please link to my site:
http://www.neofactor.com/node/31
Admin edit: Type cvs was confusing, needs to be CSV
Comments
useful tips & great theme..
Hiya Neofactor..
Very handy tips...and a great theme...is that a phptemplate theme ?
Is it available for download or is it a private one?
Cheers
Dub
DUBLIN DRUPALLER
___________________________________________________
A drupal user by chance and a dubliner by sheer luck.
Using Drupal to help build Artist & Band web communities.
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
What is file called?
Does the CSV file need to have a specific name to be called?
in the script
yes...
it is listed in the script...
Call it whatever you want.
just put the script and the csv files in your drupal root.
David McIntosh
neofactor.com
User Import Module
I used neofactor's work as the starting point for a full featured User Import module, which is now available.
Cortext Communications
Drupal Themes & Modules
------------------------------------------
Drupal Specialists: Consulting, Development & Training
Robert Castelo, CTO
Code Positive
London, United Kingdom
----
Planning to use this User Import Module
Hi,
I would like to use the same module. But i've these questions. Basically i've to migrate data or user accounts from MS-SQL to Drupal MySQL and each account has some more details other username & password. So does this module import other user's data like Address, Gender, Telephone number etc. I believe i need to make .csv file from MS-SQL db first and then i should try with this User Import Module. Is there any tool that i can use to extract whole site MS-SQL and migrate it to Drupal MySQL db? Should i be able to keep the old registration dates for each user? Please help me with suitable solution for my case.
Thanks
You can create whatever
You can create whatever profile fields you like in Drupal, then match the columns of your csv file to them in User Import module - enabling you to import various kinds of data.
Download the module and read the README.txt file for more info,
Cortext Communications
Drupal Themes & Modules
------------------------------------------
Drupal Specialists: Consulting, Development & Training
Robert Castelo, CTO
Code Positive
London, United Kingdom
----
How can we make this work for Drupal 5.1
It does not seem to fine database.inc, database.mysql.inc user.module and so on and further on providing all paths gives lot of warnings such as follows:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/imsalumn/public_html/includes/database.mysql.inc on line 153
Warning: mysql_errno(): supplied argument is not a valid MySQL-Link resource in /home/imsalumn/public_html/includes/database.mysql.inc on line 168
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/imsalumn/public_html/includes/database.mysql.inc on line 153
Warning: mysql_errno(): supplied argument is not a valid MySQL-Link resource in /home/imsalumn/public_html/includes/database.mysql.inc on line 168
USENAME [FIRSTNAME LASTNAME] OK