DanielYWoo
03-18-2011, 11:31 AM
I can create a user programtically with the code below:
$newuser =& datamanager_init('User', $this->vbulletin, ERRTYPE_ARRAY);
$newuser->set('username', $username);
$newuser->set('email', $email);
$newuser->set('password', 'password');
$newuser->set('usergroupid', 2);for this scenario
$newuser->save();
But how can I load a user and only update a a couple of fields and then write back to db? I read through the code and I guess I can use $vbulletin->db->query_write($sql) to do this, but it will skip the datamanager validation. Do you guys have a better solution?
$newuser =& datamanager_init('User', $this->vbulletin, ERRTYPE_ARRAY);
$newuser->set('username', $username);
$newuser->set('email', $email);
$newuser->set('password', 'password');
$newuser->set('usergroupid', 2);for this scenario
$newuser->save();
But how can I load a user and only update a a couple of fields and then write back to db? I read through the code and I guess I can use $vbulletin->db->query_write($sql) to do this, but it will skip the datamanager validation. Do you guys have a better solution?