I am registering users via csv file. I get user details, then save them in the usual users table using the JUser
class. What is not working are extra columns I have. I've created them in the db already. My code is as below
$pass = 'xxxxxxx'; //default
$data = array(
"name"=>$allnew[$i]->name,
"username"=>$allnew[$i]->username,
"password"=>$pass,
"password2"=>$pass,
"email"=>$allnew[$i]->email,
"telephone"=>$allnew[$i]->telephone,
"test"=>strtolower($allnew[$i]->test),
"test1"=>$allnew[$i]->test1,
"gid"=>18,
"usertype"=>$newUsertype
);
$userr = new JUser;
if(!$userr->bind($data)) {
throw new Exception("Could not bind data. Error: " . $userr->getError());
}
$userr->set('id', 0);
$userr->set('usertype', $newUsertype);
$userr->set('gid', $authorize->get_group_id( '', $newUsertype, 'ARO' ));
$date =& JFactory::getDate();
$userr->set('registerDate', $date->toMySQL());
$userr->set('leavedays', $data['leavedays']);
$useractivation = $usersConfig->get( 'useractivation' );
if ($useractivation == '1')
{
jimport('joomla.user.helper');
$userr->set('activation',$pass );
$userr->set('block', '1');
}
if($userr->save()) {
echo ' Success';
} else { echo 'error'; }
Please help. test
and test1
are not being saved and I can't tell why. Both columns exist in the database.