//----------------------------
$username = $modx->getLoginUserName();
echo $username;
//----------------------------
It doesn’t echo anything...
But how is it possible that it doesn’t echo at all??
It should either return a webuser’s or a manager’s name, but not nothing!
function getLoginUserName(){
if($this->isFrontend() && isset($_SESSION['webValidated'])) {
return $_SESSION['webShortname'];
}
else if($this->isBackend() && isset($_SESSION['mgrValidated'])) {
return $_SESSION['mgrShortname'];
}
}
Apparently we have detected a situation where the program thinks that neither isFrontend nor isBackend resolves to true or expected Session values are not set.
I found this behaviour in other cirumstances too, that’s why I post in this thread.
There is so many "hidden logic" in MODx, that returning nothing is not acceptable.
It should at least return an error-code. So each and every function
must return something, like Java code, which ususally ends with a throw exception directive. In this case: another elseif branch, who makes sure that something not as meaningless as "nothing" will be returned.