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();
Also exists as ViewHelper:
{nnt3:frontendUser.get(key:'first_name')}
{nnt3:frontendUser.get()->f:variable.set(name:'feUser')}
| @return array
\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();
Alternatively, true can be used to return the complete data set for the user groups
can be returned:
\nn\t3::FrontendUser()->getAvailableUserGroups( true );
| @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();
| @return string
\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();
return string
\nn\t3::FrontendUser()->getCurrentUser();
Get array with the data of the current FE user.
\nn\t3::FrontendUser()->getCurrentUser();
| @return array
\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] ]
| @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();
| @return int
\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 );
| @return array
\nn\t3::FrontendUser()->getLanguage();
Get language UID of the current user
$languageUid = \nn\t3::FrontendUser()->getLanguage();
| @return int
\nn\t3::FrontendUser()->getSession();
Get the current user session.
\nn\t3::FrontendUser()->getSession();
| @return \TYPO3\CMS\Core\Session\UserSession
\nn\t3::FrontendUser()->getSessionData($key = NULL);
Get session data for FE users
\nn\t3::FrontendUser()->getSessionData('store')
| @return mixed
\nn\t3::FrontendUser()->getSessionId();
Get session ID of the current frontend user
$sessionId = \nn\t3::FrontendUser()->getSessionId();
| @return string
\nn\t3::FrontendUser()->hasRole($roleUid);
Checks whether the user has a specific role.
\nn\t3::FrontendUser()->hasRole( $roleUid );
@param $role
@return bool
\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, ...]] );
| @return boolean
\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 );
@param ServerRequest $request
@return boolean
\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');
@param $username
@param $password
@throws ReflectionException
\nn\t3::FrontendUser()->logout();
Log out the current FE-USer manually
\nn\t3::FrontendUser()->logout();
| @return void
\nn\t3::FrontendUser()->removeCookie();
Manually delete the current fe_typo_user cookie
\nn\t3::FrontendUser()->removeCookie()
| @return void
\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' );
| @return array
\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 );
| @return void
\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#$' );
| @return boolean
\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);
| @return mixed