user2507818
user2507818

Reputation: 3037

typo3 extetension: issue with object: fe_user

I am reading a extension file, and see below codes:

if ($job && $job['cruser_id'] != $GLOBALS['TSFE']->fe_user->user['uid'])

I find out $GLOBALS['TSFE']->fe_user is the object of class:tslib_feuserauth, i checked the file: class.tslib_feuserauth.php,

my question is :

what is user['uid']? user is an array, but in class.tslib_feuserauth.php did not see such codes like: $this->user['uid']

Upvotes: 0

Views: 154

Answers (1)

biesior
biesior

Reputation: 55798

If user is logged this array represents user's row from DB and just contains all columns of fe_users table otherwise it's FALSE, so you can use it to determine the login state:

if ($GLOBALS['TSFE']->fe_user->user){
    $msg = 'You are logged as ' . $GLOBALS['TSFE']->fe_user->user['username'];
} else {
    $msg = 'You need to login first';
}

Upvotes: 1

Related Questions