Question

So i'm using kohana user module, and i would like to extend my register page, now it adds username, email, and password but i would like to add some extra fields, and i just can't find where can i do it.

I found function action_register which leads to Auth::instance()->register($_POST, true); so i found this function register($fields) which leads to $user = ORM::factory('user'); and $user->create_user($fields, array() so i'm stuck somewhere here, i'm not even sure if i'm going the right path...

Was it helpful?

Solution

Just create user.php file under application/classes/model folder and put this inside:

<?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
   }
}

After checking the register function, here is the place for other fields (line 22-27):

$user->create_user($fields, array(
                                'username',
                                'password',
                                'email',
                                'user_type',
                                'other field',
                                'other field2',
                        ));

Of course you'll need to have other_field and other_field2 exist in your table.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top