2011-12-22 44 views
1

所以我用Kohana的用戶模塊,並且我想延長我的註冊頁面,現在它增加了用戶名,電子郵件和密碼,但我想添加一些額外的領域,和我只是無法找到我在哪裏可以做到這一點。如何擴展Kohana的用戶身份驗證模塊

我發現function action_register導致Auth::instance()->register($_POST, true);,所以我發現這個function register($fields)導致$user = ORM::factory('user');$user->create_user($fields, array()所以我在這裏卡住的地方,我什至不知道如果我要在正確的道路......

回答

3

只需創建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_fieldother_field2在表中存在。

+0

這是完全錯誤的,我已經擁有的一切fylly完成我只需要找到執行實際的查詢,所以我可以添加額外的字段 – Linas

+0

Exnted的'create_user'功能,那麼如果你已經得到了一切飛行? – matino

+0

該功能看起來像這樣http://pastebin.com/fqk61PH7 ,它是沒有意義的我.. – Linas