How can I integrate ion_auth library with CodeIgniter 3 HMVC?

Jerielle picture Jerielle · Oct 29, 2015 · Viewed 9.1k times · Source

I used ion_auth before in my project and I have no problem with that. Now I have a project that has an HMVC approach.

Here's what i did in my setup.

  1. I download ion_auth
  2. I put the ion_auth folder in my module and load the sql
  3. I auth load the ion_auth in my config
    • $autoload['libraries'] = array('session', 'auth/Ion_auth', 'acl');
  4. I modify the load config in the ion_auth library

    $this->load->config('auth/ion_auth', TRUE);
    $this->load->library(array('email'));
    $this->lang->load('auth/ion_auth');
    $this->load->helper(array('cookie', 'language','url'));
    
    $this->load->library('session');
    
    $this->load->model('auth/ion_auth_model');
    

And when I load ion_auth in my brower it says,

Unable to load the requested class: Ion_auth

And also I autoload the library in the Auth controller

<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Auth extends MX_Controller {

    public $autoload = array(
        'libraries' => array(
            'auth/Ion_auth', 'form_validation', 'acl'
        ),
        'helper' => array(
            'url', 'language'
        )
    );

    function __construct()
    {
        parent::__construct();
        $this->load->database();

        //$this->load->library(array('auth/ion_auth','form_validation'));
        //$this->load->helper(array('url','language'));

        $this->form_validation->set_error_delimiters($this->config->item('error_start_delimiter', 'ion_auth'), $this->config->item('error_end_delimiter', 'ion_auth'));

        $this->lang->load('auth');
    }

But still same error.

I don't know what part I missed. Can you help me?

Answer