Creating MyBB forum accounts automatically with TheHostingTool
01-09-2011 @ 7:55AM EST
Download MyBB here: http://www.mybb.com
In /includes/ajax.php:
Make public function create() look like the following:
Code:
public function create() {
global $main;
global $server;
$server->signup();
$server->createForumuser();
}
In /includes/class_server.php:
Find:
Code:
}
?>
Add above:
Code:
public function createForumuser() {
global $db, $main, $type, $email;
$query = $db->query("SELECT * FROM `
users` WHERE `user` = '{$main->getvar['username']}'");
if($db->num_rows($query) != 0) {
define("IN_MYBB", 1);
global $main, $mybb, $lang, $query, $db, $cache, $plugins, $displaygroupfields, $errormessage;
require_once "../bb/global.php";
require_once "../bb/inc/functions_user.php";
require_once "../bb/inc/datahandlers/user.php";
$userhandler = new UserDataHandler("insert");
$user = array(
"username" => $main->getvar['username'],
"password" => $main->getvar['password'],
"usergroup" => "2",
"email" => $main->getvar['email'],
"regip" => $_SERVER['REMOTE_ADDR']
);
$userhandler->set_data($user);
if($userhandler->validate_user()) {
$user_info = $userhandler->insert_user();
die();
}
}
else {
die();
}
}
Edit the file locations and usergroup based on your setup. Don't forget to disable registration on your MyBB forum or the script may break.
I think there are more code edits but to be honest I don't have time to go through all of the files to find them right now. If you get any errors let me know and it should tell me what edits I'm forgetting.
mybb, tutorials, thehostingtool, scripts
Comments
This article hasn't been commented yet.


Write a comment
* = required field