Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PreHook for FormIt to load User data into form
if (!$modx->user->hasSessionContext($modx->context->get('key')) return '';
$userArray = $modx->user->toArray();
$profile = $modx->user->getOne('Profile');
if ($profile) {
$userArray = array_merge($profile->toArray(),$userArray);
$extended = $profile->get('extended');
if (!empty($extended) && is_array($extended)) {
$userArray = array_merge($extended,$userArray);
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment