10
I modified the function insert() in kernel/user.php:
ORIGINAL
--------
function insert(&$user, $force = false)
{
if (!parent::insert($user, $force)) {
return false;
}
$profile = $user->getProfile();
$profile->setVar('profileid', $user->getVar('uid'));
// save profile
if (!$this->_pHandler->insert($profile, $force)) {
foreach ($profile->getErrors() as $error) {
$user->setErrors($error);
}
return false;
}
return true;
}
NEW
---------
function insert(&$user, $force = false)
{
foreach ($user->cleanVars as $k => $v) {
if ($user->vars[$k]['data_type'] == XOBJ_DTYPE_INT) {
$cleanvars[$k] = intval($v);
} elseif ( is_array( $v ) ) {
$cleanvars[ $k ] = $this->db->quoteString( implode( ',', $v ) );
} else {
$cleanvars[$k] = $this->db->quoteString($v);
}
}
if ($user->isNew()) {
$sql= sprintf("INSERT INTO %s (uname, loginname, name, email, user_avatar, pass, rank, level) VALUES (%s, %s, %s, %s, %s, %s, %u, %u); ", $this->db->prefix('users'), $this->db->quoteString($user->getVar('uname')), $this->db->quoteString($user->getVar('loginname')),$this->db->quoteString($user->getVar('name')), $this->db->quoteString($user->getVar('email')), $this->db->quoteString($user->getVar('user_avatar')), $this->db->quoteString($user->getVar('pass')), $user->getVar('rank'), $user->getVar('level'));
if (false != $force) {
$result = $this->db->queryF($sql);
} else {
$result = $this->db->query($sql);
}
$user->setVar('uid',$this->db->getInsertId());
$sql= sprintf("INSERT INTO %s (umode, uorder, notify_method, attachsig, user_mailok, user_from, user_sig, bio, user_occ, user_regdate, actkey) VALUES (%s, %s, %s, %u, %u, %s, %s, %s, %s, %u, %s)", $this->db->prefix('user_profile'), $this->db->quoteString('nest'),$this->db->quoteString('1') ,$this->db->quoteString($user->getVar('notify_method')), $this->db->quoteString($user->getVar('attachsig')),$this->db->quoteString($user->getVar('user_mailok')), $this->db->quoteString($user->getVar('user_from')), $this->db->quoteString($user->getVar('user_sig')), $this->db->quoteString($user->getVar('bio')), $this->db->quoteString($user->getVar('user_occ')), time(), $this->db->quoteString($user->getVar('actkey')));
if (false != $force) {
$result = $this->db->queryF($sql);
} else {
$result = $this->db->query($sql);
}
return $result;
} else {
if (!parent::insert($user, $force)) {
return false;
}
$profile = $user->getProfile();
$profile->setVar('profileid', $user->getVar('uid'));
if (!$this->_pHandler->insert($profile, $force)) {
foreach ($profile->getErrors() as $error) {
$user->setErrors($error);
}
return false;
}
}
return true;
}
END
---------
New users can't register yet. But now xoops_user_profile has the correct values in fields,and now xoops_users is the table whith blank values.
Though, I can to register new user from my computers!!!!
Please, I need help!