API:getLoginUserName
API Quick reference
|
Description / Usage
mixed getLoginUserName();
Determines if user is logged in, be it via Manager Interface, or Web Interface, and returns an string with the User Name of the current user. If no user is logged in, null is returned.
Examples
echo ($modx->getLoginUserName)?"Hello, ".$modx->getLoginUserName()."!":"Hello, Guest!";
Related
- getLoginUserID
- [userLoggedIn]
- isBackend
- isFrontend
Notes
In the manager, the value returned will be the manager user's username.
Function Source
File: manager/includes/document.parser.class.inc.php
Line: 2028
function getLoginUserName() {
if ($this->isFrontend() && isset ($_SESSION['webValidated'])) {
return $_SESSION['webShortname'];
}
elseif ($this->isBackend() && isset ($_SESSION['mgrValidated'])) {
return $_SESSION['mgrShortname'];
}
}