PDA

View Full Version : [HELP] vB 3.6.8 -> 4.x Custom Registration Integration


psalzmann
12-15-2010, 04:15 AM
Hi everyone,

I hope someone could point me in the right direction regarding upgrading my existing code snippet (working on vb 3.6.8) which I'm trying to convert for vB 4.x (latest version)..

We removed the register option (register.php) which takes the user to a custom registration page we've been using for years without problem. I was hoping to see if my existing code will still work for creating a new user in vb 4.x.


// #### vbulletin checkups #############################
if (LOCALHOST == false)
{
// vb seems to use the same db object..
$db2 = $db;
unset($db);

// #### VB FORUM HOOKUP ########################
define('THIS_SCRIPT', 'index.php');

chdir(DIR_FORUM);

require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_user.php');

$userdm = new vB_DataManager_User($vbulletin, ERRTYPE_ARRAY);

$userdm->set('username', $_POST['signinname']);
$userdm->set('email', $_POST['email']);
$userdm->set('password', $_POST['password']);
$userdm->set('usergroupid', "2");
$userdm->set('ipaddress', $_SERVER['REMOTE_ADDR']);
$userdm->set('timezoneoffset', "-5");
$userdm->set_bitfield('options', 'adminemail', '1');
$userdm->set_bitfield('options', 'showemail', '1');

if (count($userdm->errors))
{
// forum registration problems!!
for ($i=0; $i<count($userdm->errors); $i++)
{
$error .= '<span style="color:red">' . $userdm->errors[$i] . '</span><br />';
}
}
else
{
// user was registered!
$forumuserid = $userdm->save();
}
unset($userdm);

// all done with vbulletin! back to our site..
chdir(ROOTDIR);
}


Many thanks!