2017-05-07, 05:47 AM
Hello, I'm quite new to MyBB and I'm trying to implement some modifications to the registration of new accounts in my site. I'm using the Enhanced Account Switcher Plugin found here ( https://community.mybb.com/mods.php?action=view&pid=408 ) and I want to check new users for their e-mail, if it has been used by a master account then I want to display a window for the user to input its username and password, verify that login information, and if it is correct attach the newly created account to that parent account.
Here is what I've got so far:
How could I display the window, collect and validate this information, and continue with the registry of the account?
Here is what I've got so far:
// Set the data for the new user.
$user = array(
"username" => $mybb->get_input('username'),
"password" => $mybb->get_input('password'),
"password2" => $mybb->get_input('password2'),
"email" => $mybb->get_input('email'),
"email2" => $mybb->get_input('email2'),
"usergroup" => $usergroup,
"referrer" => $mybb->get_input('referrername'),
"timezone" => $mybb->get_input('timezoneoffset'),
"language" => $mybb->get_input('language'),
"profile_fields" => $mybb->get_input('profile_fields', MyBB::INPUT_ARRAY),
"regip" => $session->packedip,
"coppa_user" => $coppauser,
"regcheck1" => $mybb->get_input('regcheck1'),
"regcheck2" => $mybb->get_input('regcheck2'),
"registration" => true
);
$query_registered_mails = $db->simple_select("users", "email, as_uid", "email='".$user['email']."' AND as_uid='0'", array("order_by" => 'name',"order_dir" => 'DESC'));
// Check if mail exists in Database and belongs to a Master Account
if($db->num_rows($query_registered_mails) > 0)
{
// Require username and password from master account
// Validate master account login information
// If correct set user as_uid to the master account uid
// Otherwise display registration error
}
How could I display the window, collect and validate this information, and continue with the registry of the account?