Sorry I'm an'idiot!
I called save() twice!!!
Announcement
Collapse
No announcement yet.
Datamanager error
Collapse
X
-
Datamanager error
Hi,
I'm developing a class to save users directly from my system bypassing vbulletin.
I have a problem.
Saving data I get database tipical vbulletin error but, datas are correct saved!
My code follow, is someone able to tell me why appens this?
(informations are for test)
Thanks
PHP Code:<?php
require_once('./global.php');
$dm =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);
$dm->set('username','utentedadm8');
$dm->set('usergroupid',2);
$dm->set('password','123456');
$dm->set('email','[email protected]');
$dm->set('usertitle','Matricola');
$dm->set('timezoneoffset',2);
$dm->set('birthday','10-06-1984');
$dm->set('birthday_search','1984-06-10');
$dm->set('pmpopup',1);
$dm->set('ipaddress',$_SERVER['REMOTE_ADDR']);
$dm->set('autosubscribe',2);
$dm->set('startofweek',2);
$dm->pre_save();
if (count($dm->errors) > 0)
{
// Errors occurred. Do not proceed with the save.
// You may want to loop through $dataman->errors and
// display the results the user.
echo "ERRORS <pre>";
print_r($dm->errors);
echo "</pre>";
}
else
{
// No errors occurred.
// Proceed with the save (see the next step).
// inserting a new user
$userid = $dm->save();
echo $userid;
// updating an existing record
@$dm->save();
}
?>Tags: None
Related Topics
Collapse
-
Can someone provide an example that actually works and can be tested for clarity of how to use the Data Manager API. The examples that are in the manual are sniplets that are missing elements that will...
-
Channel: Support Issues & Questions
Thu 4 Aug '16, 2:17pm -
-
I can't get 5.3.4 and php 7.2.2 with opcache to work. The info.php page shows but the site just kicks a 500 error. Not even the admincp works. I have tried disabling all hooks through the config file....
-
Channel: Support Issues & Questions
Thu 8 Feb '18, 6:33am -
Leave a comment: