所以我使用kohana用户模块,我想扩展我的注册页面,现在它添加了用户名,电子邮件和密码,但我想添加一些额外的字段,我只是找不到我在哪里可以做到。
我发现function action_register
导致Auth::instance()->register($_POST, true);
,所以我发现这个function register($fields)
导致$user = ORM::factory('user');
和$user->create_user($fields, array()
,所以我被困在这里的某个地方,我甚至不确定我是否走正确的道路…
在application/classes/model文件夹下创建user.php文件,并将其放入
<?php
defined('SYSPATH') or die('No direct access allowed.');
class Model_User extends Model_Auth_User
{
public function create_user($values, $expected)
{
// Your definition of the function
}
}
检查寄存器函数后,这里是其他字段的位置(第22-27行):
$user->create_user($fields, array(
'username',
'password',
'email',
'user_type',
'other field',
'other field2',
));
当然你需要有other_field
和other_field2
在你的表