UserSessionVariable
- Type
- Class
- Namespace
- Craft
- Inherits
- Craft\UserSessionVariable
- Since
- 1.0
User session functions.
See also http://craftcms.com
View source (opens new window)
# Public Methods
Method | Description |
---|---|
getAuthTimeout() | Returns the number of seconds the user will be logged in for. |
getFlash() | Returns a flash message by a given key. |
getFlashes() | Returns all flash data for the user. |
getRememberedUsername() | Returns the remembered username from cookie. |
getReturnUrl() | Returns the URL the user was trying to access before getting sent to the login page. |
getUser() | Returns the currently logged in user. |
hasFlash() | Returns whether a flash message exists by a given key. |
isLoggedIn() | Returns whether the user is logged in. |
# getAuthTimeout()
Returns the number of seconds the user will be logged in for.
View source (opens new window)
Returns
Signature
public integer getAuthTimeout ( )
# getFlash()
Returns a flash message by a given key.
View source (opens new window)
Arguments
$key
(string (opens new window))$defaultValue
(mixed
)$delete
(boolean (opens new window))
Returns
mixed
Signature
public mixed getFlash ( $key, $defaultValue = null, $delete = true )
# getFlashes()
Returns all flash data for the user.
View source (opens new window)
Arguments
$delete
(boolean (opens new window))
Returns
Signature
public array getFlashes ( $delete = true )
# getRememberedUsername()
Signature
public string getRememberedUsername ( )
# getReturnUrl()
Returns the URL the user was trying to access before getting sent to the login page.
View source (opens new window)
Arguments
$defaultUrl
(string (opens new window)) – The default URL that should be returned if no return URL was stored.$delete
(boolean (opens new window)) – Whether the stored return URL should be deleted after it was fetched.
Returns
string (opens new window) – The return URL, or $defaultUrl.
Signature
public string getReturnUrl ( $defaultUrl = null, $delete = false )
# getUser()
Signature
public Craft\UserModel, null getUser ( )
# hasFlash()
Returns whether a flash message exists by a given key.
View source (opens new window)
Arguments
$key
(string (opens new window))
Returns
mixed
Signature
public mixed hasFlash ( $key )
# isLoggedIn()
Signature
public boolean isLoggedIn ( )