Search code examples
codeigniterion-auth

ion auth and codeigniter


I am playing with codeigniter and ion auth for the first time. I have got everything working however, in the ion auth template, the index view displays a list of all users.

<?php foreach ($users as $user):?>
    <tr>
        <td><?php echo $user->first_name;?></td>
        <td><?php echo $user->last_name;?></td>
        <td><?php echo $user->email;?></td>
        <td>
            <?php foreach ($user->groups as $group):?>
                <?php echo anchor("auth/edit_group/".$group->id, $group->name) ;?><br />
            <?php endforeach?>
        </td>
        <td><?php echo ($user->active) ? anchor("auth/deactivate/".$user->id, 'Active') : anchor("auth/activate/". $user->id, 'Inactive');?></td>
        <td><?php echo anchor("auth/edit_user/".$user->id, 'Edit') ;?></td>
    </tr>
<?php endforeach;?>

Normally the $users array would come from the model. however upon looking into the model(ion_auth_model), I cant see anything specific to $users. the auth controller doesn't give me too much either.

in the documentation, the users() function is: $users = $this->ion_auth->users();

I presume this is the array being populated on the index page. How is this pulling the MySQL data if not in a model? how does this work?


Solution

  • @Smudger - look a little closer, the ion_auth_model has a function users() starting around line 1125 (depending on your version) that takes an optional $groups argumant