:) 这个问题适合任何熟悉 Tankauth 插件的人。
我编辑了 tankauth,以便在没有电子邮件验证的情况下填充用户配置文件。
在注册表单中,我添加并验证了另外两个名为“first_name”和“last_name”的字段,我想在提交表单时将它们添加到 user_profiles 表中。
下面是 tankauth 函数,如果用户被激活,它会将用户 ID 添加到 user_profiles 表中。我注释掉了 if ($activated)。问题是我不知道如何将我的新字段 first_name 和 last_name 插入到数据库中。我尝试的任何事情都会出错。
function create_user($data, $activated = TRUE)
{
$data['created'] = date('Y-m-d H:i:s');
$data['activated'] = $activated ? 1 : 0;
if ($this->db->insert($this->table_name, $data)) {
$user_id = $this->db->insert_id();
//if ($activated)
$this->create_profile($user_id);
return array(
'user_id' => $user_id,
'first_name' => $first_name, //added by me
'first_name' => $first_name, //added by me
);
}
return NULL;
}
以上与
private function create_profile($user_id)
{
$this->db->set('user_id', $user_id);
$this->db->set('first_name', $first_name); //added by me
return $this->db->insert($this->profile_table_name);
}
有人可以分享一些指导吗?