maximux1
07-06-2006, 03:46 PM
Hello all,
I'm working with vB3.6B4. This is my first attempt at working with the datamanager api and I am having some difficulting in understanding it. I've created a very simple code snippit as an example to play with and I just can't get this to work right, I was hoping some professional eyes might be able to shed some experience on this for me.
$styleid = "4";
$dataman =& datamanager_init('User', $vbulletin);
$dataman->set_existing($vbulletin->userinfo);
$dataman->set('styleid', $styleid);
$dataman->pre_save();
if (!empty($dataman->errors)) {
$errorlist = '';
foreach ($userdata->errors AS $index => $error) {
$errorlist .= "<li>$error</li>";
}
}
else {
$vbulletin->userinfo['styleid']
= $styleid
= $dataman->save();
$styleid = $vbulletin->userinfo['styleid'];
echo "STYLEID: $styleid";
}
I have a test forum setup and I am working outside of the vb directory including the following files;
require_once('./global.php');
require_once('./includes/init.php');
I am simply trying to change the styleid in the vB db for the logged in user and display the changed value of $vbulletin->userinfo['styleid'].
As it works now, the user -> styleid table is updated with the correct styleid, however $vbulletin->userinfo['styleid'] seems to always display '1'.
Am I over looking something? Thank you for your asistance.
Max
Sorry to waste your time.
I've found the problem in my code and now have my example working correctly.
Max
I'm working with vB3.6B4. This is my first attempt at working with the datamanager api and I am having some difficulting in understanding it. I've created a very simple code snippit as an example to play with and I just can't get this to work right, I was hoping some professional eyes might be able to shed some experience on this for me.
$styleid = "4";
$dataman =& datamanager_init('User', $vbulletin);
$dataman->set_existing($vbulletin->userinfo);
$dataman->set('styleid', $styleid);
$dataman->pre_save();
if (!empty($dataman->errors)) {
$errorlist = '';
foreach ($userdata->errors AS $index => $error) {
$errorlist .= "<li>$error</li>";
}
}
else {
$vbulletin->userinfo['styleid']
= $styleid
= $dataman->save();
$styleid = $vbulletin->userinfo['styleid'];
echo "STYLEID: $styleid";
}
I have a test forum setup and I am working outside of the vb directory including the following files;
require_once('./global.php');
require_once('./includes/init.php');
I am simply trying to change the styleid in the vB db for the logged in user and display the changed value of $vbulletin->userinfo['styleid'].
As it works now, the user -> styleid table is updated with the correct styleid, however $vbulletin->userinfo['styleid'] seems to always display '1'.
Am I over looking something? Thank you for your asistance.
Max
Sorry to waste your time.
I've found the problem in my code and now have my example working correctly.
Max