0

I’m getting error when trying to autoload ion_auth library

application/config/autoload.php

$autoload['libraries'] = array('database', 'template', 'asset', 'ion_auth/ion_auth'); 

folder structure:

application/
  ...
  modules/
    ion_auth/
      ...
      config/
        ion_auth.php
      ...
    tester/
      controllers/
        tester.php 

I try to var_dump($this->ion_auth) on tester.php and get error message:

The configuration file ion_auth.php does not exist.

I try to $this->load->library('ion_auth/ion_auth') from tester.php and remove the ionauth from autoload, It still error. How to solve this?

I download codeigniter from link on codeigniter.com and download Modular Extension from bitbucket

Permana
  • 1,972
  • 2
  • 33
  • 51
  • Hi, did you check my answer? I made it work perfectly and I had the same problem as you, XD. I think everything is because you don't load the config file, check full answer below... – Federico J. Apr 09 '13 at 22:33

3 Answers3

2

It's not an issue with Modular Extensions. You need to put the config file for Ion Auth into the main application's config folder, not in the Ion Auth directory.

Just move it from application/modules/ion_auth/config/ion_auth.php to application/config/ion_auth.php. That will take care of the config error, but you'll probably need to move the entire Ion Auth library into application/libraries.

Chris Schmitz
  • 8,097
  • 6
  • 31
  • 41
  • yes it can be done, but I want to make it into one module. Just like what PyroCMS done. I also try to crossload ion auth model from tester.php and it still says same error message. What confuse me is, I successfully crossload model when I was using codeigniter 1.7.2 few weeks ago. But when I use version 2.0.2 with modular extension from bitbucket, and doing almost the same thing as PyroCMS, i'm getting error. I already done what the modular extension wiki, setting the configuration etc, it works well, the only problem is this crossload things. There must be something that I missed out – Permana Aug 07 '11 at 18:21
0

I'm doing exactly the same as you, HMVC from wiredesignz, CI and Ion_auth and I had the same problem. I solved it loading the config file PRIOR the library, :P, I don't know if this would be your problem, but I also had exactly the same error message. My construct method with Ion_auth looks like

class Auth extends MY_Controller {

function __construct()
{
    parent::__construct();

    // THIS LINE BEFORE LOAD THE LIBRARY:
    $this->load->config('auth/ion_auth', TRUE);

    $this->load->library('ion_auth');
    $this->load->library('session');
    $this->load->library('form_validation');
    $this->form_validation->CI = & $this;
    $this->load->database();
    $this->load->helper('url');
    $this->load->helper('cookie');

    $this->load->library('email');
    $this->load->library('session');
    $this->lang->load('auth/ion_auth');
    $this->load->model('auth/ion_auth_model');      
}
Federico J.
  • 15,388
  • 6
  • 32
  • 51
  • This might work, haven't test it yet. But it load the config in controller, I'm thinking about loading config in ion_auth libraries. My question is very old, I actually find a workaround. I just add prefix ion_auth/ when loading something in Ion_auth library – Permana Apr 10 '13 at 03:29
0

I don't use Modular Extensions, but from the looks of your code, I'd venture to guess that CI doesn't know to look in the ion_auth folder for the config folder.

If Modular Extensions has a config option, make sure to set it to look in the extension's folder for a config folder. If it doesn't, you'll need to either tell CI directly about the config folder, or put the ion_auth config file into a recognized config folder.

Shauna
  • 9,495
  • 2
  • 37
  • 54