$a = "lalala </br> lalala </br> lalala \n lalala </br>\n lalalala"; return $a;
$out = 'Current User ID: '; $out .= $modx->getLoginUserID(); $out .= ';</br> User Name: '; $out .= $modx->getLoginUserName(); $out .= ';</br> User Type: '; $out .= $modx->getLoginUserType(); $out .= "</br>\nUser Info: \n"; $uinfo = var_export($modx->getwebUserInfo($modx->getLoginUserID()), true); $out .= $uinfo; return $out;
$out = "Current User ID: "; $out .= $modx->getLoginUserID() . "<br />"; $out .= "User Name: "; $out .= $modx->getLoginUserName() . "<br />"; $out .= "User Type: "; $out .= $modx->getLoginUserType() . "<br />"; $out .= "User Info:<br />"; $uinfo = $modx->getwebUserInfo($modx->getLoginUserID()); foreach($uinfo as $key=>$value) { $out .= " " . ucwords($key) . " => " . $value . "<br />"; } return $out;
$a = "lalala </br> lalala </br> lalala \n lalala </br>\n lalalala"; return $a;
I didn’t figure out how to make a line break.... It seems taht html-style </br> doesn’t work...
foreach($uinfo as $key=>$value) { $out .= " " . ucwords($key) . " => " . $value . "<br />"; }
? MODx Parse Error ?
MODx encountered the following error while attempting to parse the requested resource:
? PHP Parse Error ?
PHP error debug
Error: Invalid argument supplied for foreach()
Error type/ Nr.: Warning - 2
File: C:\WebSite\modx\manager\includes\document.parser.class.inc.php(620) : eval()’d code
Line: 9
Parser timing
MySQL: 0.0085 s s (7 Requests)
PHP: 0.0449 s s
Total: 0.0534 s s
if ($modx->getLoginUserType() == 'web') { $out .= "<br/>User Info: "; $inf = $modx->getwebUserInfo($modx->getLoginUserID()); if (!is_null($inf)) { $uinfo = var_export($inf, true); foreach($uinfo as $key=>$value) { $out .= " " . ucwords($key) . " => " . $value . "<br />"; } } else { $out .= '<br/> User info not available...';} }
? MODx Parse Error ?
MODx encountered the following error while attempting to parse the requested resource:
? PHP Parse Error ?
PHP error debug
Error: Invalid argument supplied for foreach()
Error type/ Nr.: Warning - 2
File: C:\WebSite\modx\manager\includes\document.parser.class.inc.php(620) : eval()’d code
Line: 15
Parser timing
MySQL: 0.0138 s s (7 Requests)
PHP: 0.0540 s s
Total: 0.0677 s s
str_replace("\n",'<br/>',$uinfo);
if($uinfo = $modx->getwebUserInfo($modx->getLoginUserID())) { // check for if logged in at all if($modx->getLoginUserType() == 'web') { // check for if is web user $out = "Current User ID: "; $out .= $uinfo['internalKey'] . "<br />"; $out .= "User Name: "; $out .= $uinfo['username'] . "<br />"; $out .= "User Type: "; $out .= $modx->getLoginUserType() . "<br />"; $out .= "User Info:<br />"; foreach($uinfo as $key=>$value) { $out .= " " . ucwords($key) . " => " . $value . "<br />"; } return $out; } else { // user is not web user $out = "User is not logged in as a web user"; return $out; } } else { // getwebUserInfo did not return anything $out = "User is not logged in."; return $out; }
This doesn’t display anything?
Thanks for your work, I’ll try to figure it out on my own.