Welcome Guest, Not a member yet? Register   Sign In
Ion Auth - Lightweight Auth System based on Redux Auth 2

[eluser]Oliver Zeyen[/eluser]
Hi Ben! Thanks for the fast reply!

Quote:In my application controller: load ion_auth and call $this->ion_auth->get_userdata(); php gives me the following error...

this was a typo... I actually call $this->ion_auth->get_user() and the error is thrown.

Oliver

[eluser]Oliver Zeyen[/eluser]
Hey Ben!

I've started a vanilla installation of ci 2.0.1 with the latest modular extension running properly. I'm able to load modules. I dont use any extended controllers. just the plain welcome_controller.php.

ion_auth is now installed as a simple library, not as a module which somehow was a compromise, because i thought this would help in my case. in fact i prefer the library method.

session and database are autoloaded. ion_auth is loadad and invoked in the welcome controller. same problem here.

Code:
class Welcome extends CI_Controller {

    
    public function index()
    {
        $this->load->library('ion_auth');
                #var_dump($this->ion_auth->get_user()); // Cool! Userdata returned
        $this->load->module('navigation'); // load my module as needed
        $navigation = $this->navigation->get_navigation(); // get my navigation
        #var_dump($this->ion_auth->get_user()); // Bad!

        $this->load->view('welcome_message');
    }
}

I've attached a screenshot of the error message. There seems to ba a problem with the magic __get function in core/Model.php, too.

Thanks for your help!

[eluser]jk215[/eluser]
[quote author="Ben Edmunds" date="1300438841"]jk215,

Are you still having this issue?[/quote]

Yes. Basically the only steps Ive taken were to change the CONFIG option to 'username' and attempt to login using the default /auth/login.

[eluser]Ben Edmunds[/eluser]
Oliver,

Are you loading Ion Auth in the parent class? For example, if you are extending a bunch of classes but your most parent class in MY_Controller, load Ion Auth there.

[eluser]Ben Edmunds[/eluser]
Oliver,

Also make sure you're using the newest Ion Auth from github.

[eluser]Unknown[/eluser]
great library Smile

[eluser]Metlhead723[/eluser]
I downloaded your Ion Auth package for Code Igniter the other day and I didn't see a controller listed to handle "edit_user.php". Do you have that code?...or am I missing something to see that view? Please get back to me when you can. Thanks!

[eluser]Oliver Zeyen[/eluser]
Hi Ben!

Everything works fine now!! It seems really important to use the "MY_Controller" in combination with modular extensions, if you want to use the this->load->module() or module::run method to access modules on runtime. (As the Manual says Wink... My fault!)

If you access your modules by uri like a "normal" controller, ion_auth works without any problems.

So in my case:

Load ion_auth inside the My_Controller and extend EVERY Controller from this one... Or just autoload it! Bingo!

Thanks for your help! Your library rocks!

Oliver

[eluser]Ben Edmunds[/eluser]
Glad to help Oliver.

[eluser]Ben Edmunds[/eluser]
Metlhead723,

I just emailed you back (assuming it was you). There isn't a ready made example for that, the code there is just to be used as an example so you can make your own.




Theme © iAndrew 2016 - Forum software by © MyBB