Hi Everyone,
I've extended modUser to extUser by the written tutorials on the
http://rtfm.modx.com/display/revolution20/Extending+modUser. However when I go to my website not logged in I get a blank page. The php Error log saids that the get() is calling to a non object in my class.
In the tutorial ti's the line 32
$this->userID = $this->userObj->get('id');
Anyone else experienced this problem? Should I make an if statement to check if the user is logged in?
Bigger part of the code:
function __construct(modX & $modx, array $config= array ()) {
/* Import modx as a reference */
$this->modx= & $modx;
/* Establish the environment */
$this->extPath= $modx->getOption('core_path',null, MODX_CORE_PATH).'components/extendeduser/';
$this->modx->addPackage('extendeduser', $this->extPath .'model/', 'ut_');
$this->_config= array_merge(array (
'userID' => $this->modx->user->get('id'),
), $config);
/* Define the user */
$this->userObj = $this->setUser($this->_config['userID']);
$this->userID = $this->userObj->get('id');
}
Best regards,
Rogier