I recently had a need to include some user data in a template. I used the following code to turn all of the attributes of the current user into placeholders.
This goes inside a snippet:
// set web user details as placeholders
$user = $modx->userLoggedIn();
$user_details = $modx->getWebUserInfo($user['id']);
$modx->toPlaceholders($user_details, 'user!');
The first line gets a few details about the logged in user, I’m using the API function userLoggedIn() just to get the user’s id.
Then on line 2, an array of the user’s data is retrieved using another API function, getWebUserInfo().
On the third line, I make the user’s record available as a set of placeholders, all prefixed with "user!". This is arbitrary, I could have used a prefix of "eggs_".
When the snippet is included on a page, then you can put placeholders like [+user!email+] or [+user!fullname+].
This is not the most secure or tested code.. for entertainment purposes only ;-)