FrontendUser 

\nn\t3::FrontendUser() 

Overview of Methods 

\nn\t3::FrontendUser()->get(); 

Get the current FE user. Alias to \nn\t3::FrontendUser()->getCurrentUser();

\nn\t3::FrontendUser()->get();
Copied!

Also exists as ViewHelper:

{nnt3:frontendUser.get(key:'first_name')}
{nnt3:frontendUser.get()->f:variable.set(name:'feUser')}
Copied!

| @return array

| ➜ Go to source code of FrontendUser::get()

\nn\t3::FrontendUser()->getAvailableUserGroups($returnRowData = false); 

Return all existing user groups. Returns an associative array, key is the uid, value is the title.

\nn\t3::FrontendUser()->getAvailableUserGroups();
Copied!

Alternatively, true can be used to return the complete data set for the user groups can be returned:

\nn\t3::FrontendUser()->getAvailableUserGroups( true );
Copied!

| @return array

| ➜ Go to source code of FrontendUser::getAvailableUserGroups()

\nn\t3::FrontendUser()->getCookie(); 

Gets the current fe_typo_user cookie.

$cookie = \nn\t3::FrontendUser()->getCookie();
Copied!

| @return string

| ➜ Go to source code of FrontendUser::getCookie()

\nn\t3::FrontendUser()->getCookieName(); 

Get the cookie name of the frontend user cookie. Usually fe_typo_user, unless it has been changed in the LocalConfiguration.

\nn\t3::FrontendUser()->getCookieName();
Copied!

return string

| ➜ Go to source code of FrontendUser::getCookieName()

\nn\t3::FrontendUser()->getCurrentUser(); 

Get array with the data of the current FE user.

\nn\t3::FrontendUser()->getCurrentUser();
Copied!

| @return array

| ➜ Go to source code of FrontendUser::getCurrentUser()

\nn\t3::FrontendUser()->getCurrentUserGroups($returnRowData = false); 

Get user groups of the current FE user as an array. The uids of the user groups are used as keys in the returned array.

// Minimal version: By default, Typo3 only returns title, uid and pid
\nn\t3::FrontendUser()->getCurrentUserGroups(); // [1 => ['title'=>'Group A', 'uid' => 1, 'pid'=>5]]

// If true, the complete data record for the fe_user_group can be read from the DB
\nn\t3::FrontendUser()->getCurrentUserGroups( true ); // [1 => [... all fields of the DB] ]
Copied!

| @return array

| ➜ Go to source code of FrontendUser::getCurrentUserGroups()

\nn\t3::FrontendUser()->getCurrentUserUid(); 

Get UID of the current frontend user

$uid = \nn\t3::FrontendUser()->getCurrentUserUid();
Copied!

| @return int

| ➜ Go to source code of FrontendUser::getCurrentUserUid()

\nn\t3::FrontendUser()->getGroups($returnRowData = false); 

Get user groups of the current FE user. Alias to \nn\t3::FrontendUser()->getCurrentUserGroups();

// only load title, uid and pid of the groups
\nn\t3::FrontendUser()->getGroups();
// load complete data set of the groups
\nn\t3::FrontendUser()->getGroups( true );
Copied!

| @return array

| ➜ Go to source code of FrontendUser::getGroups()

\nn\t3::FrontendUser()->getLanguage(); 

Get language UID of the current user

$languageUid = \nn\t3::FrontendUser()->getLanguage();
Copied!

| @return int

| ➜ Go to source code of FrontendUser::getLanguage()

\nn\t3::FrontendUser()->getSession(); 

Get the current user session.

\nn\t3::FrontendUser()->getSession();
Copied!

| @return \TYPO3\CMS\Core\Session\UserSession

| ➜ Go to source code of FrontendUser::getSession()

\nn\t3::FrontendUser()->getSessionData($key = NULL); 

Get session data for FE users

\nn\t3::FrontendUser()->getSessionData('store')
Copied!

| @return mixed

| ➜ Go to source code of FrontendUser::getSessionData()

\nn\t3::FrontendUser()->getSessionId(); 

Get session ID of the current frontend user

$sessionId = \nn\t3::FrontendUser()->getSessionId();
Copied!

| @return string

| ➜ Go to source code of FrontendUser::getSessionId()

\nn\t3::FrontendUser()->hasRole($roleUid); 

Checks whether the user has a specific role.

\nn\t3::FrontendUser()->hasRole( $roleUid );
Copied!
@param $role
@return bool

| ➜ Go to source code of FrontendUser::hasRole()

\nn\t3::FrontendUser()->isInUserGroup($feGroups = NULL); 

Checks whether the current frontend user is within a specific user group.

\nn\t3::FrontendUser()->isInUserGroup( 1 );
\nn\t3::FrontendUser()->isInUserGroup( ObjectStorage );
\nn\t3::FrontendUser()->isInUserGroup( [FrontendUserGroup, FrontendUserGroup, ...] );
\nn\t3::FrontendUser()->isInUserGroup( [['uid'=>1, ...], ['uid'=>2, ...]] );
Copied!

| @return boolean

| ➜ Go to source code of FrontendUser::isInUserGroup()

\nn\t3::FrontendUser()->isLoggedIn($request = NULL); 

Checks whether the user is currently logged in as a FE user. Earlier: isset($GLOBALS['TSFE']) && $GLOBALS['TSFE']->loginUser

// Check after complete initialization of the front/backend
\nn\t3::FrontendUser()->isLoggedIn();

// Check using the JWT, e.g. in an eID script before authentication
\nn\t3::FrontendUser()->isLoggedIn( $request );
Copied!
@param ServerRequest $request
@return boolean

| ➜ Go to source code of FrontendUser::isLoggedIn()

\nn\t3::FrontendUser()->login($username, $password = NULL); 

Log in user manually. from v10: Alias to \nn\t3::FrontendUserAuthentication()->loginByUsername( $username );

\nn\t3::FrontendUser()->login('99grad');
Copied!
@param $username
@param $password @throws ReflectionException

| ➜ Go to source code of FrontendUser::login()

\nn\t3::FrontendUser()->logout(); 

Log out the current FE-USer manually

\nn\t3::FrontendUser()->logout();
Copied!

| @return void

| ➜ Go to source code of FrontendUser::logout()

\nn\t3::FrontendUser()->removeCookie(); 

Manually delete the current fe_typo_user cookie

\nn\t3::FrontendUser()->removeCookie()
Copied!

| @return void

| ➜ Go to source code of FrontendUser::removeCookie()

\nn\t3::FrontendUser()->resolveUserGroups($arr = [], $ignoreUids = []); 

Converts an array or a comma-separated list with user group UIDs into | fe_user_groups data from the database. Checks for inherited subgroup.

\nn\t3::FrontendUser()->resolveUserGroups( [1,2,3] );
\nn\t3::FrontendUser()->resolveUserGroups( '1,2,3' );
Copied!

| @return array

| ➜ Go to source code of FrontendUser::resolveUserGroups()

\nn\t3::FrontendUser()->setCookie($sessionId = NULL, $request = NULL); 

Set the fe_typo_user cookie manually.

If no sessionID is passed, Typo3 searches for the FE user's session ID itself.

When calling this method from a MiddleWare, the request should be passed with . This allows, for example, the global $_COOKIE value and the cookieParams.fe_typo_user in the request before authentication via typo3/cms-frontend/authentication in a separate MiddleWare must be set. Helpful if cross-domain authentication is required (e.g. via Json Web Token / JWT).

\nn\t3::FrontendUser()->setCookie();
\nn\t3::FrontendUser()->setCookie( $sessionId );
\nn\t3::FrontendUser()->setCookie( $sessionId, $request );
Copied!

| @return void

| ➜ Go to source code of FrontendUser::setCookie()

\nn\t3::FrontendUser()->setPassword($feUserUid = NULL, $password = NULL); 

Change the password of an FE user. Alias to \nn\t3::FrontendUserAuthentication()->setPassword().

\nn\t3::FrontendUser()->setPassword( 12, '123password$#' );
\nn\t3::FrontendUser()->setPassword( $frontendUserModel, '123Password#$' );
Copied!

| @return boolean

| ➜ Go to source code of FrontendUser::setPassword()

\nn\t3::FrontendUser()->setSessionData($key = NULL, $val = NULL, $merge = true); 

Set session data for FE user

// Merge session data for `shop` with new data (existing keys in `shop` are not deleted)
\nn\t3::FrontendUser()->setSessionData('store', ['a'=>1]);

// Overwrite session data for `shop` (`a` from the example above is deleted)
\nn\t3::FrontendUser()->setSessionData('store', ['b'=>1], false);
Copied!

| @return mixed

| ➜ Go to source code of FrontendUser::setSessionData()

Methods