• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ion_auth V2 meta table?

#1
[eluser]Andy78[/eluser]
Is the meta table still used in V2? I have a large amount of fields to add and dont want them to go in the users table.

As far as I can tell I have set up everything correctly but it is not storing the additional data in the meta table.

Forexample in my ion_auth config file I have the following:

Code:
/*
| -------------------------------------------------------------------------
| Tables.
| -------------------------------------------------------------------------
| Database table names.
*/
$config['tables']['users']           = 'users';
$config['tables']['groups']          = 'groups';
$config['tables']['users_groups']    = 'users_groups';
$config['tables']['login_attempts']  = 'login_attempts';

$config['tables']['meta'] = 'users_profiles';

/*
| Users table column and Group table column you want to join WITH.
|
| Joins from users.id
| Joins from groups.id
*/
$config['join']['users']  = 'user_id';
$config['join']['groups'] = 'group_id';
$config['join']['meta'] = 'user_id';


/**
     * Columns in your meta table,
     * id not required.
     **/
$config['columns'] = array('gender','dateofbirth','ethnicity');

In my data base I have a table called users_profiles that contains the fields

and in my controller I have the following just to test:

Code:
function add_admin_user(){

    $sections = array(
    'config'  => TRUE,
    'queries' => TRUE
    );
    $this->output->enable_profiler(TRUE);
    $this->output->set_profiler_sections($sections);

        $username = 'benedmunds';
        $password = '12345678';
        $email = '[email protected]';
        $additional_data = array(
                                'gender' => 'Male',
                                'dateofbirth' => '1978-04-21',
                                'ethnicity' => 'white'
                                );
        $group = array('1'); // Sets user to admin. No need for array('1', '2') as user is always set to member by default

        $this->ion_auth->register($username, $password, $email, $additional_data, $group);

Any ideas?

#2
[eluser]Andy78[/eluser]
Looks like everything goes in the user tables with v2. It was just adding
extra queries without much benefit.

#3
[eluser]loughlin[/eluser]
Hmm, a project I am working on has extra fields of up to 14 - I preferred the meta table option to keep these fields separate. I just found it easier when working with the database on the command line.

It would be nice to still have this feature although it looks like the v2 codebase has changed significantly to remove the meta table.

Loughlin.

#4
[eluser]Andy78[/eluser]
You can just add your own meta table, and use a standard query to access the fields..thats what Iv done.

#5
[eluser]loughlin[/eluser]
@andy78 hmm, that is true! I just tried it out there and used the user_id as the foreign key, worked a treat.

Duh!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.