Forum .LRN Q&A: Re: Re: Re: Bulk User Account problem

Posted by Matthew Coupe on
OK, I haven't been able to sort out this problem and would really love some advice. I've had a look at the users-bulk-upload-2.tcl file and the important bit is

set user_id [db_nextval acs_object_id_seq]

auth::create_user \
-user_id $user_id \
-username "$row(username)" \
-email $row(email) \
-first_names $row(first_names) \
-last_name $row(last_name) \
-password $password

I have seen in some bug fixes that it should actually be changed to this instead...

set user_id [ad_user_new $row(email) $row(first_names) $row(last_name) $password "" "" "" "t" "approved"]

Anyone know anything about this and how it should read?


Posted by Malte Sussdorff on
Okay, the auth::create_user is correct and the way to go.

What I would check though is to write out all variables like user_id, $row(username) and so on into your logfile using ns_log Notice to make sure your CSV file is correct and all data is present. Furthermore make sure that you CSV file does not contain extra "," where they don't belong.

Posted by Matthew Coupe on
Thanks for getting back Malte.
I have tried it with the following CSV files:




I have searched through them with a toothpick and couldn't find anything wrong with any of them. I may be really stupid and have missed something REALLY obvious out of this file...

I'll try the ns_log now and see what I can get. I hope I can get this fixed because we've got 20,000 accounts to create in the next month!


Posted by Malte Sussdorff on
I assume that you do not have spaces in your e-mail address CSV, otherwise this would be the first thing to do "regsub -all { } $email {} email".

Furthermore make absolutely sure that there is no blank line or anything like this in your CSV file at the end.

And last but not least, think about getting rid of the db_transaction and just log (instead of stop) on error, so you know which users failed to get inserted.