2009-03-04, 10:51 PM
Hi all,
Forgive me if this is possibly explained somewhere but also a question.
Seems as if the new versions of myBB has changed up how a user is added into the database.
I have a piece of software that use to upon login create a mybb forum account for the user w/ the same credentials they logged into the other software.
The code was this:
Which worked great... Now things seemed to have changed quite a bit in the new versions.
Could anyone point me towards a solution on doing it with 1.4.x?
Forgive me if this is possibly explained somewhere but also a question.
Seems as if the new versions of myBB has changed up how a user is added into the database.
I have a piece of software that use to upon login create a mybb forum account for the user w/ the same credentials they logged into the other software.
The code was this:
define('IN_MYBB', '1' );
require_once "./global.php";
require_once MYBB_ROOT."inc/functions_user.php";
$plugins->run_hooks("member_do_register_start");
require_once MYBB_ROOT."inc/datahandlers/user.php";
$userhandler = new UserDataHandler("insert");
////////////////////////////////////////////////////////////////////////////
$username = "$_POST[username]";
$password = "$_POST[password]";
$email = "$_POST[email]";
if(!$username || !$password || !$email) {
echo "not enough info";
exit;
}
$usergroup = "2";
$timezone = "-5";
$ip_address = $_SERVER['REMOTE_ADDR'];
// Set the data for the new user.
$user = array(
"username" => $username,
"password" => $password,
"password2" => $password,
"email" => $email,
"email2" => $email,
"usergroup" => $usergroup,
"referrer" => $referrername,
"timezone" => $timezone,
"language" => $language,
"profile_fields" => $mybb->input['profile_fields'],
"regip" => $ip_address
);
$user['options'] = array(
"allownotices" => "yes",
"hideemail" => "yes",
"emailnotify" => "yes",
"receivepms" => "yes",
"pmpopup" => "yes",
"emailpmnotify" => "yes",
"invisible" => "",
"dst" => ""
);
$userhandler->set_data($user);
if($userhandler->validate_user())
$user_info = $userhandler->insert_user();
$plugins->run_hooks("member_do_register_end");
Which worked great... Now things seemed to have changed quite a bit in the new versions.
Could anyone point me towards a solution on doing it with 1.4.x?