0

我让 Ion_auth 工作得很好,但后来更改了表名:

$config['tables']['users']           = 'users_1';
$config['tables']['groups']          = 'groups_1';
$config['tables']['users_groups']    = 'users_groups_1';
$config['tables']['login_attempts']  = 'login_attempts_1';

当我尝试注册某人时,它现在不起作用。我收到以下错误:

Fatal error: Call to a member function clear() on a non-object in ....application\libraries\Ion_auth.php on line 353

我怀疑它与 ion_auth 配置文件中的以下内容有关:

/*
 | 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';

有人可以解释如何设置这两个字段吗?

更新:这里是 ion_auth 注册函数:

public function register($username, $password, $email, $additional_data = array(),     $group_name = array()) //need to test email activation
{
    $this->ion_auth_model->trigger_events('pre_account_creation');

    $email_activation = $this->config->item('email_activation', 'ion_auth');

    if (!$email_activation)
    {
        $id = $this->ion_auth_model->register($username, $password, $email, $additional_data, $group_name);
        if ($id !== FALSE)
        {
            $this->set_message('account_creation_successful');
            $this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_successful'));
            return $id;
        }
        else
        {
            $this->set_error('account_creation_unsuccessful');
            $this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_unsuccessful'));
            return FALSE;
        }
    }
    else
    {
        $id = $this->ion_auth_model->register($username, $password, $email, $additional_data, $group_name);

        if (!$id)
        {
            $this->set_error('account_creation_unsuccessful');
            return FALSE;
        }

        $deactivate = $this->ion_auth_model->deactivate($id);

        if (!$deactivate)
        {
            $this->set_error('deactivate_unsuccessful');
            $this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_unsuccessful'));
            return FALSE;
        }

        $activation_code = $this->ion_auth_model->activation_code;
        $identity        = $this->config->item('identity', 'ion_auth');
        $user            = $this->ion_auth_model->user($id)->row();

        $data = array(
            'identity'   => $user->{$identity},
            'id'         => $user->id,
            'email'      => $email,
            'activation' => $activation_code,
        );
        if(!$this->config->item('use_ci_email', 'ion_auth'))
        {
            $this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_successful', 'activation_email_successful'));
            $this->set_message('activation_email_successful');
                return $data;
        }
        else
        {
            $message = $this->load->view($this->config->item('email_templates', 'ion_auth').$this->config->item('email_activate', 'ion_auth'), $data, true);

    line 353:       $this->email->clear();
            $this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));
            $this->email->to($email);
            $this->email->subject($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_activation_subject'));
            $this->email->message($message);

            if ($this->email->send() == TRUE)
            {
                $this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_successful', 'activation_email_successful'));
                $this->set_message('activation_email_successful');
                return $id;
            }
        }

        $this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_unsuccessful', 'activation_email_unsuccessful'));
        $this->set_error('activation_email_unsuccessful');
        return FALSE;
    }
}

附录2:ion auth 模型构造函数:

 public function __construct()
{
    parent::__construct();
    $this->load->database();
    $this->load->config('ion_auth', TRUE);
    $this->load->helper('cookie');
    $this->load->helper('date');
    $this->lang->load('ion_auth');
4

0 回答 0