1
nixon
bulk user creation
  • 2005/3/15 10:55

  • nixon

  • Just popping in

  • Posts: 35

  • Since: 2003/3/7 2


Hi,
I need to bulk create users on my site. I have the data although I am unsure if a simple text file upload to the one of the tables will work. Is there multiple table entries when a user is created? How is the password encrypted? Is there means for doing this or some kind of script or mod that has worked for some one before. If any one has tackled this problem before I would be interested in hearing from you.
Cheers

2
christian
Re: bulk user creation
  • 2005/3/15 12:50

  • christian

  • Just can't stay away

  • Posts: 401

  • Since: 2002/2/24


Hi Nixon,

you can look this thread.

Best regards

3
nixon
Re: bulk user creation
  • 2005/3/16 0:32

  • nixon

  • Just popping in

  • Posts: 35

  • Since: 2003/3/7 2


Thanks for that christian,
I am just having a play with it and have a couple of questions.
1. The sql file named bd_test does that need to be renamed to import_test?
2. Does this file attempt to recreate the users and the groups_users_links table? I already have a lot of users in these tables and I did not wish to wipe them out.

4
christian
Re: bulk user creation
  • 2005/3/16 1:13

  • christian

  • Just can't stay away

  • Posts: 401

  • Since: 2002/2/24


1) The file bd_test.sql is just use for test your data file in a test database

2)yes, the script (phpfile.php) create the users in the xoops_users table(line 34) and xoops_groups_users_link (line 50). No the current users are not deleted.

(sorry for my poor english)

5
nixon
Re: bulk user creation
  • 2005/3/16 1:38

  • nixon

  • Just popping in

  • Posts: 35

  • Since: 2003/3/7 2


your English is far better than my French.

I'm not great at php but I am having a read of the script and trying to work out the comments etc. At the moment I keep getting this error when I try to run the script:

Début de l'importation du fichier data.csv
Erreur dans la base de données : No Database Selected
Importation stoppée.

I have changed the $host, $user and $pass to reflect my settings. Is there something wrong in the csv file? I just added one user to try and reflect the data that was in the test csv file. This is what I added:

BLOGGA;BLOGGS;Bill;3B;ELEVE;O;1;E3B;BARRA

6
nixon
Re: bulk user creation
  • 2005/3/16 1:54

  • nixon

  • Just popping in

  • Posts: 35

  • Since: 2003/3/7 2


Sorry I have worked outmy error now. I will just have to work on the csv file to get wat i want. Thanks for the help. I had no put the database name in at the top.
Cheers

7
nixon
Re: bulk user creation
  • 2005/3/16 2:10

  • nixon

  • Just popping in

  • Posts: 35

  • Since: 2003/3/7 2


Can I ask a couplemore things christian,

1. what does each of these parts of the csv stand for
3B;ELEVE;O;1;E3B

2. I seem to have another user that was created with an id number as the username and just the trailing part of the e-mail address (@eq.edu.au) as the only other information added. Is this normal?

8
christian
Re: bulk user creation
  • 2005/3/16 13:38

  • christian

  • Just can't stay away

  • Posts: 401

  • Since: 2002/2/24


1) At first this file was created for a school.

2) I don't know

I made a new package where the users file contains only : user, name, email.

If not email in file, this is created automatically with your domains.

You can download here

Best regards

9
nixon
Re: bulk user creation
  • 2005/3/20 23:41

  • nixon

  • Just popping in

  • Posts: 35

  • Since: 2003/3/7 2


Thanks christian,
I mainly needed to know if those last 4 entries were vital but it appears from your new script that they are not necessary. I pretty much have worked out the script and have added other things I needed for mine so it looks like it will work ok. Thanks for all the help this will save me a lot of work.

10
nixon
Re: bulk user creation
  • 2005/3/22 2:18

  • nixon

  • Just popping in

  • Posts: 35

  • Since: 2003/3/7 2


christian,
I used the original script (slightly changed) to do the job but I realised I need the users added to 2 groups. I had a look at the changed script you made and in reference to this section:

//Add user in group
$numgroup ='2';
$query = "INSERT INTO xoops_groups_users_link (groupid, uid) VALUES('$numgroup', '$uid')";
$result= mysql_query($query);

If I wanted to add the user to 2 groups when running the script (lets say groups 2 and 6) how would I change the script to make this happen? Any help would be appreciated.
Cheers

Login

Who's Online

178 user(s) are online (102 user(s) are browsing Support Forums)


Members: 0


Guests: 178


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits