[eluser]JasonS[/eluser]
I am reorganising my application and I am having some trouble calling a Library function. The library class is being autoloaded. This is working as this function works when called from a template file.
However when I try to call it from my controller I get a PHP error.
Error:
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined property: Reception::$User
Filename: controllers/reception.php
Line Number: 17
Fatal error: Call to a member function userIsLoggedIn() on a non-object in /Applications/xampp/xamppfiles/htdocs/JasonHome/system/application/controllers/reception.php on line 17
Autoload:
Code:
$autoload['libraries'] = array('database', 'session', 'setsession', 'user');
Function I am trying to call
Code:
class User
{
private $CI;
public function __construct()
{
$this->CI =& get_instance();
}
public function userIsLoggedIn($id = NULL)
{
$id = idIsUserId($id);
if ($id > 0)
{
return true;
}
}
}
The line calling it
Code:
class Reception extends Controller
{
function __construct()
{
parent::Controller();
}
function Register()
{
// Load Model
$this->load->model('reception/registration');
// Redirect Registered Users
if ($this->User->userIsLoggedIn()) // <<---- Error pops up here
{
header('location: '.base());
}
Does anyone know what is going on? Help resolving this matter would be greatly appeciated.