galt
05-10-2009, 03:42 PM
I am trying to sync registartion between vB and my CMS.
Here is what finally worked to get it to interpret cleanly.
if ($vbswitch == 'Y') {
chdir('./forums');
define('THIS_SCRIPT','pg_usermgmt.php');
define('VB_AREA', 'Forum');
require_once("global.php");
require_once("./includes/class_dm.php");
require_once("./includes/class_dm_user.php");
chdir('../');
};
and then further on (but not yet tested)
if ($vbswitch == 'Y') {
$newuser =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);
$newuser->set('username', $UserName);
$newuser->set('email', $EMail);
$newuser->set('password', $Password);
$newuser->set('usergroupid', 2);
if ($newuser->errors) {
echo $newuser->errors; // fix this later
}
else {
$newuserid = $newuser->save();
};
};
But nothing is ever simple. Now it seems that this code has broken the rest of my program. I suspect it has something to do with require_once('global.php') or one of the thousands (okay hundreds) of include files referenced thru there.
The most obvious candidates for the problem are that I have an object named $user and local variables ($UserID, $err, $error, $sbutton, $errorflag) that are used to control program flow. Do you know if any of these are part of all the global mess in VB and causing conflicts? Is there somewhere I can find a list of global variable names used by VB? Is there an easy way around this? Some of these I am stuck with (especially the $user object, which is in every program in my system). Other variable names I can changes, but would like to know which ones are causing the problem first. I have never used or allowed global variables in 35 years of programming (it's called coding discipline & standards), so know very little about them.
Here is what finally worked to get it to interpret cleanly.
if ($vbswitch == 'Y') {
chdir('./forums');
define('THIS_SCRIPT','pg_usermgmt.php');
define('VB_AREA', 'Forum');
require_once("global.php");
require_once("./includes/class_dm.php");
require_once("./includes/class_dm_user.php");
chdir('../');
};
and then further on (but not yet tested)
if ($vbswitch == 'Y') {
$newuser =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);
$newuser->set('username', $UserName);
$newuser->set('email', $EMail);
$newuser->set('password', $Password);
$newuser->set('usergroupid', 2);
if ($newuser->errors) {
echo $newuser->errors; // fix this later
}
else {
$newuserid = $newuser->save();
};
};
But nothing is ever simple. Now it seems that this code has broken the rest of my program. I suspect it has something to do with require_once('global.php') or one of the thousands (okay hundreds) of include files referenced thru there.
The most obvious candidates for the problem are that I have an object named $user and local variables ($UserID, $err, $error, $sbutton, $errorflag) that are used to control program flow. Do you know if any of these are part of all the global mess in VB and causing conflicts? Is there somewhere I can find a list of global variable names used by VB? Is there an easy way around this? Some of these I am stuck with (especially the $user object, which is in every program in my system). Other variable names I can changes, but would like to know which ones are causing the problem first. I have never used or allowed global variables in 35 years of programming (it's called coding discipline & standards), so know very little about them.