Advertisement:

Author Topic: Automatic user creation  (Read 9297 times)

Offline SBIM

  • Newbie
  • *
  • Posts: 5
Automatic user creation
« on: December 17, 2007, 09:17:25 AM »
Hello,

I would like to create 50 predefined users. Is there a way to do that automatically ? With a sql request ?

Offline H

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,662
  • Gender: Male
Re: Automatic user creation
« Reply #1 on: December 17, 2007, 10:28:20 AM »
Welcome to SMF, sbim.

You can do this but it will require a bit of scripting. What format is the list of users in?

If you already know php I suggest you take a look at the register user functions in the Function DB
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Offline SBIM

  • Newbie
  • *
  • Posts: 5
Re: Automatic user creation
« Reply #2 on: December 17, 2007, 10:45:58 AM »


It can be a list yes, with a default password, with an editor i can create a list of 50 users. Then how to import it into SMF ?

I'm not too good with PHP, can i use a script to insert my users into the SMF database ?


Offline H

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,662
  • Gender: Male
Re: Automatic user creation
« Reply #3 on: December 17, 2007, 10:55:20 AM »
I can probably write you a script to do this for you. The easiest way to do this would be to open excel and put the user data in a spreadsheet in the following format:

ABC
usernamepassworde-mail

Then save it as a comma delimited CSV. If you could send me the file via PM I can write and test some import code for you.

Would you also like the user to be e-mailed their password?
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Offline SBIM

  • Newbie
  • *
  • Posts: 5
Re: Automatic user creation
« Reply #4 on: December 17, 2007, 11:52:43 AM »
How can i PM you the file ?

Offline H

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,662
  • Gender: Male
Re: Automatic user creation
« Reply #5 on: December 17, 2007, 12:16:10 PM »
hmm you can't attach in PMs can you :(. You can e-mail it: huw@simplemachines.org or upload it to your site and send me a link via PM
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Offline H

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,662
  • Gender: Male
Re: Automatic user creation
« Reply #6 on: December 18, 2007, 10:08:01 AM »
Ok here is the code. You need to upload the file to your root directory along with a comma delimited csv called members.csv.

I also replied to your e-mail with an example csv file :)

 I tested it a few times but let me know if you encounter any problems.
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Offline ne-yola

  • Jr. Member
  • **
  • Posts: 162
Re: Automatic user creation
« Reply #7 on: August 27, 2009, 09:09:22 AM »
hello,

I need a script like this, I have the email addresses of the users, and i need a script that would use thesame email address as username and create a default paswd for the users.

It would also send them a mail for the users stating their password

Pls help , am a novice

Offline ne-yola

  • Jr. Member
  • **
  • Posts: 162
Re: Automatic user creation
« Reply #8 on: August 28, 2009, 05:51:05 PM »
hello H,

I am writing as rgd the script you wrote for automatic user creation for SBIM in 2007

I am a new bie and i have tried the script and it work just fine

but one smallprops is that i want the registered user to be sent an activation email

Thanks

Offline H

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,662
  • Gender: Male
Re: Automatic user creation
« Reply #9 on: September 01, 2009, 05:07:32 PM »
Try changing:

Code: [Select]
'require' => 'nothing',
To:

Code: [Select]
'require' => 'activation',
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Offline ne-yola

  • Jr. Member
  • **
  • Posts: 162
Re: Automatic user creation
« Reply #10 on: September 01, 2009, 06:06:25 PM »
Try changing:

Code: [Select]
'require' => 'nothing',
To:

Code: [Select]
'require' => 'activation',


sorry that wasn't exactly what i meant

i mean a welcome email

the users are about 5000 and i dn't know if there could be a time delay in sending their welcome email not to cause spam

Offline H

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,662
  • Gender: Male
Re: Automatic user creation
« Reply #11 on: September 02, 2009, 02:36:29 PM »
For a welcome e-mail just find:

Code: [Select]
'send_welcome_email' => false,
And change to:

Code: [Select]
'send_welcome_email' => true,
As for a mail time delay, this is not possible with SMF 1.1.x although you could fake one by only importing a few users at a time (splitting the CSV).

2.0 has a mail queue and you can limit the number of e-mails per minute
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Offline kevin-p63

  • Semi-Newbie
  • *
  • Posts: 15
Re: Automatic user creation
« Reply #12 on: March 30, 2010, 12:12:23 PM »
Sorry to bump up such an old thread but in looking through the board this script seems to be exactly what I need minus one field and was hoping for a little help.

I am standing up my first SMF site on an internal company network for use by employees only. We are testing for now with 2.0 RC3. Since LDAP hasn't been done for this version we are planning on pre-loading the users we want to have access and turning off registration.

Along with the 3 fields mentioned in this solution I would also like to include real_name.

Can anyone suggest how to edit the script to accomplish that?

Thanks in advance,
Kevin

Offline Illori

  • Support Specialist
  • SMF Legend
  • *
  • Posts: 52,947
Re: Automatic user creation
« Reply #13 on: January 11, 2011, 06:06:30 PM »
please use a separate topic for your issue.

Offline JimM

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,980
  • Gender: Male
    • Southern Spirit Hunters
Re: Automatic user creation
« Reply #14 on: January 26, 2011, 08:57:03 PM »
This script would default the username as the real_name as it uses the registration array.  That isn't a field that is asked for when someone registers.
Jim "JimM" Moore
Former Support Specialist

Please do not PM me for support!                   
Installing SMF
Upgrade SMF
Manual Installation of Mods

Offline twa

  • Newbie
  • *
  • Posts: 2
Re: Automatic user creation
« Reply #15 on: November 01, 2012, 09:30:07 AM »
This script does not work with smf 2.x right ?
i hav tried it, and it doesnt work ...
is there existing any resolution for smf 2.0 ?
I must import 400 users from a csv to smf.