我在函数 create_user() 中添加到身份验证控制器:
if ($this->ion_auth->is_admin())
{
$this->data['groups'] = $this->ion_auth->groups()->result_array(); // выбираем все группы
$groups=$this->data['groups'];
}
...
if ($this->form_validation->run() == true && $this->ion_auth->register($username, $password, $email, $additional_data, $groups))
...
接下来在视图中我添加下拉字段并希望使用表“组”中的所有组填充它:
<div class="grid_8"><p>Добавить в группы:<br />
<?php echo form_dropdown('groups',$groups) ?></p></div>
但我弄错了下拉列表:
0
1
admin
Administrator
1
2
moderator
Moderator
...
请帮助我了解如何列出所有组:
Administrator
Moderator
User
...