• Welcome to Simple Machines Community Forum. Please login or sign up.
September 24, 2021, 11:17:21 AM

News:

Check out the SMF Function DB!


Automatic user creation

Started by SBIM, December 17, 2007, 09:17:25 AM

Previous topic - Next topic

SBIM

Hello,

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

H

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)
                             

SBIM



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 ?


H

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)
                             

SBIM


H

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)
                             

H

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)
                             

ne-yola

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

ne-yola

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

H

Try changing:

'require' => 'nothing',

To:

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

ne-yola

Quote from: H on September 01, 2009, 05:07:32 PM
Try changing:

'require' => 'nothing',

To:

'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

H

For a welcome e-mail just find:

'send_welcome_email' => false,

And change to:

'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)
                             

kevin-p63

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

Illori

please use a separate topic for your issue.

JimM

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

twa

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.

Advertisement: