MyBB Community Forums

Full Version: get user data from another database?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi good morning everyone,

I am new into mybb forum. I got the task to develop the forum discussion from my boss. So I found that mybb is the suitable forum for my company. 

my question is, how can I transfer user data from another database into mybb user data. I don't want to register user manually because we have around 10 000 user. It will be so hard to registered manually. 

can u guys help me?
You can use SQL to insert users from an existing database to MyBB. Mandatory details you need:
- username
- email
- password - see below

Some fields in MyBB need to be set manually via SQL
- usergroup (pre-set to group Registered = 2 or Awaiting Activation = 5)
- regdate (just set to the date of insertion)
- regip / lastip (may set to the net of your company or choose any else)

The tricky thing is to set passwords for all the users.
How do you wish to handle passwords?
- You can set an initial password for all users.
- Do you have a password source from the source database or passwords set in a Windows Domain for example?
- You can convert existing passwords using the MyBB internal algorithms with md5 and salt. Depending on your source passwords.


Step 1)
Export user details from existing database - at least username and email. Convert the export to the field name "username" and "email" that it matches MyBB table, e.g.
SELECT source_user as username, source_mail as email FROM ...

Step 2)
Import the exported SQL to your MyBB table mybb_users
All missing fields will be set with standard values.

Step 3)
Update usergroup, regdate, regip, lastip
Get the current timestamp for regdate and get your IP converted to binary
UPDATE mybb_users SET usergroup = 5, regdate = 12345678, regip = DEADBEEF, lastip = DEADBEEF;

Step 4)
Passwords...

Step 5)
Refresh/reload all forum caches to bring it up to date.

[ExiTuS]
Hi [ExiTust], thanks for your reply,

before I do as per ur suggestion, I wanna ask if its is possible for me to use existing database(tbl_user) just to get the user details instead of insert the user to mybb database.

I am planning to have only 1 login only. I dont want user to login again to use the forum.

How can I achieved the goals?

My ultimate goal is:-
1)Integrate forum with umbraco CMS
2)Connect with existing database to get tbl_user data
3)Only 1 login is required(user doesnot have to login again to access forum)

Sorry if i ask a lot of question. I am very new into this mybb.