Question

Receiving this fatal error when trying to access my planner.php and shared.php controllers. Any thoughts?

Fatal error: Uncaught exception 'Exception' with message 'Undefined method Ion_auth::get_user() called' in
/application/libraries/Ion_auth.php:88 Stack trace: #0 

/application/core/MY_Controller.php(50): Ion_auth->__call('get_user', Array) #1 

/application/core/MY_Controller.php(50): Ion_auth->get_user() #2 

/application/controllers/user/planner.php(9): Common_Auth_Controller->__construct() #3

/system/core/CodeIgniter.php(288): Planner->__construct() #4 /index.php(202): require_once('/Users/lrussell...') #5 {main} thrown in/application/libraries/Ion_auth.php on line 88

Library Extension I'm Using for Ion Auth: http://jondavidjohn.com/blog/2011/01/scalable-login-system-for-codeigniter-ion_auth

Planner Controller: http://pastie.org/private/wc1bq6eiqb9hn8iubwdgq

Shared Controller: http://pastie.org/private/uj3ta8dw3jl7kqxizs9n1a

Ion_auth Library Line 88 Segment: http://pastie.org/private/mhgwdzjyhatwsdrux4gqpa

CRUD Model: http://pastie.org/private/m2nhfqzabdsx5eiz6xqupw

Events Model: http://pastie.org/private/b6ksjoowl7wde9errow

Shared Model: http://pastie.org/private/f741jfnf8o2l5oxphnrl5w

Was it helpful?

Solution

Uhm, it happened to me the same exact thing. In the latest releases of this library, Ben Edmunds used php magic method __call() so that you don't have to call a model's method by using the regular syntax $this->ion_auth_model->method() but using instead $this->ion_auth->method(), as if it was a method belonging to the library.

But, actually, that method belongs to the model. So, if you go have a look at the model, you'll see that there's no get_user() method (nor is there in the library!), or at least in the version I talk about (the latest or the one just before. I downloaded a fresh copy one or two weeks ago). I think there are some errors in the documentation he provided (though the overall work he did is awesome, kudos to Ben).

You can try using the user() model method, which should yield to the same result (it's the closer in functionality). So call $this->ion_auth->user() and see if that fits your needs.

EDIT

To clarify... instead of this...

$this->end_user = $this->ion_auth->current()->row();

do this...

$this->end_user = $this->ion_auth->user()->row();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top