Mass create users from file

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Get Involved
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
jankarremans
Registered User
Posts: 36
Joined: Fri Sep 26, 2008 7:39 am

Mass create users from file

Post by jankarremans »

Hi there good people of phpBB,

I need to mass-create users in a phpBB forum.
I need to do this from a text-file which I can shape in any form still.
Is there some way (an import or other kind of text-feedable script) with which this can be done?
I don't really know any PHP :oops: so if it can be somekind of a simple something...

Who can / will help me undertake this enterprise?? :ugeek:

Thanx a bunch
User avatar
citricsquid
Registered User
Posts: 74
Joined: Sat Nov 10, 2007 1:07 pm

Re: Mass create users from file

Post by citricsquid »

You could create a mysql query inside a while loop that inserts the information directloy into the database, bypassing any phpBB involvement, however I am unsure of the actual registration process, which could mean it inserts information seperate to the actual user database which is required for a user account to run.
jankarremans
Registered User
Posts: 36
Joined: Fri Sep 26, 2008 7:39 am

Re: Mass create users from file

Post by jankarremans »

Okay, this I get, but there is no usable solution here, right?
User avatar
citricsquid
Registered User
Posts: 74
Joined: Sat Nov 10, 2007 1:07 pm

Re: Mass create users from file

Post by citricsquid »

jankarremans wrote:Okay, this I get, but there is no usable solution here, right?
As far as I know, no.
You could run something like iMacros to submit the information using the member create in the admin panel, so you set it to populate the fields and then submit, then go back, submit... however this won't work with captcha enabled.

I'll take a look at how member registration works, if it's as simple as inserting data into a single table, I'll whip something together for you.
jankarremans
Registered User
Posts: 36
Joined: Fri Sep 26, 2008 7:39 am

Re: Mass create users from file

Post by jankarremans »

Somewhere I found some kind of script which could do this function... But I cannot find it again. Besides it was PHP-code and I don't have the ability to alter that orso...

I need to pre-create (in batch and furthermore like with little batches) over 700 users in the forum with pre-designed passwords to accomplish a business-objective which we have defined.
So, preferably it would be through an import or through a function that can read a text-file. It would touch tables users, user-groups and groups, if I am not mistaken.

Issue is, for instance, the password hash that one needs and perhaps other dependencies of which I am not aware...

I would indeed welcome assistance and perhaps this could be a nice new function for phpBB 4 ? :roll:
User avatar
citricsquid
Registered User
Posts: 74
Joined: Sat Nov 10, 2007 1:07 pm

Re: Mass create users from file

Post by citricsquid »

So, to get this clear:

You want to register 700 users, you want to choose their username and password, but have everything else set as default? Like so:

Username | Password
_________ ________

And 700 input boxes, or do you want 1 big input box where you can paste in username and password? If so, how are they seperated? Is it like

username : sam
password : cake
username : arthur
password : buns

or,

sam cake arthur buns

?
jankarremans
Registered User
Posts: 36
Joined: Fri Sep 26, 2008 7:39 am

Re: Mass create users from file

Post by jankarremans »

The first part is right on the money!
The second part I would favor some kind of text-file which can be picked up from the file-system orso, some .csv

user 1, password, perhaps some other option 1, perhaps some other option 2, etc.
user 2, password, perhaps some other option 1, perhaps some other option 2, etc.
user 3, password, perhaps some other option 1, perhaps some other option 2, etc.
user 4, password, perhaps some other option 1, perhaps some other option 2, etc.

Which can be digested by an interface...

Preferably this is something which is not rocket-science 8-)
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51682
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Mass create users from file

Post by stevemaury »

Be aware that you can't put a plain text password into the phpbb users table. It must be an MD5 hash.

Here is an example SQL query that creates a user, in this case a founder admin user with the username Admin and the password admin:

Code: Select all

INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
For an activated user, you would want to change the user_type to 0, and to put them in the Registered users group, you would change the group_id to the id of that group. The default is, I believe, 117, but you can check that by looking at the group_id of a person in the database whose default group is registered users.

If you use usernames with all lowercase and no special characters, the username and username_clean will be the same.

So, if you generate the MD5 hashed passwords, you can use a CSV file to do this with a little planning. Good luck.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
jankarremans
Registered User
Posts: 36
Joined: Fri Sep 26, 2008 7:39 am

Re: Mass create users from file

Post by jankarremans »

This already looks very promising!! I will go work on this ;-)

Any further tools for this are welcome! though...
jankarremans
Registered User
Posts: 36
Joined: Fri Sep 26, 2008 7:39 am

Re: Mass create users from file

Post by jankarremans »

stevemaury wrote:If you use usernames with all lowercase and no special characters, the username and username_clean will be the same.
And what if they are not? We have quite an international group... And people from Sweden, for instance have letters with 'o' above and like with accents and stuff...
User avatar
Noxwizard
Support Team Leader
Support Team Leader
Posts: 10416
Joined: Mon Jun 27, 2005 8:41 pm
Location: Texas, USA
Name: Patrick Webster
Contact:

Re: Mass create users from file

Post by Noxwizard »

You really shouldn't add users directly into the database. Look at the user_add() function in includes/functions_user.php. There are other tables that need to be updated as well, and that function will do it all for you. That wiki article is somewhat dated, as the md5() should be phpbb_hash(), but it's still a good example.
[Support Template] - [Read Before Posting] - [phpBB Knowledge Base]
Do not contact me for private support, please share the question in our forums.
jankarremans
Registered User
Posts: 36
Joined: Fri Sep 26, 2008 7:39 am

Re: Mass create users from file

Post by jankarremans »

I know this and I respect this.
I would much much rather have some kind of tool which I can feed usernames orso, which will bulk-do-this for me... I don't know PHP, so no chance I will be able to make this myself, I do know, though, sql and databases, which gives me a much more safe feeling...
There sould perhaps also something be done with php_user_groups and php_groups?

Please can you point me into a better direction according to your opinion?
jankarremans
Registered User
Posts: 36
Joined: Fri Sep 26, 2008 7:39 am

Re: Mass create users from file

Post by jankarremans »

An option would also be an sql-script...
I would upload username, e-mail to the database in a new table, and have the users created by a script...
Then I would like to know what that script would look like...
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51682
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Mass create users from file

Post by stevemaury »

It would look just like it does when I posted it above, except you would delete the fields and data that will be provided by the user_add function.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
jankarremans
Registered User
Posts: 36
Joined: Fri Sep 26, 2008 7:39 am

Re: Mass create users from file

Post by jankarremans »

Okay!! I can figure this out... no worries...

The other guy was talking about updating other tables as well... but I wouldn't figure which tables...

And the phpbb-hash function, can I call it from native sql also?? like

Code: Select all

select phpbb_hash("password") from dual;
??

Thanx for the help!
Cheerz...
Locked

Return to “[3.0.x] Support Forum”