getLoginUserName
API Quick reference
Variable name: | getLoginUserName |
CMS versions: | 0.9.x + Evo |
Input parameters: | |
Return if successful: | Logged in user ID |
Return type: | mixed |
Return on failure: | null |
Object parent: |
API:getLoginUserName
Description / Usage
mixed getLoginUserName();
Determines if user is logged in, be it via the admin 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 Admin Interface, the value returned will be the Admin Interface 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']; } }
Suggest an edit to this page.