[英]how to extend kohana user auth module
所以我正在使用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
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.