MyBB Community Forums

Full Version: Insert in MyBB database to create user
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm considering using MyBB as an add-on to my site - when users register on my site can I insert a user record into the MyBB database and have them automatically enrolled and assign them to a group and/or default BB?

Thanks for any guidance that you can provide!
You will need to use the user datahandler class.
Step 1: In your script include the mybb file global.php.
Step 2: Include the file inc/datahandlers/user.php
Step 3: Create an instance of the UserDataHandler class. ex. $userhandler = new UserDataHandler("insert");
Step 4: Once you have an array of data bout the user, call the set_data($array) method.
Step 5: Call the validate_user method. There aren't any arguments to provide. This is required before using the insert method.
Step 6: Call the insert_user method. This returns the information about the user.