Created
August 26, 2011 17:48
-
-
Save splittingred/1173958 to your computer and use it in GitHub Desktop.
PreHook for FormIt to load User data into form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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); | |
} | |
} | |
$hook->setValues($userArray); | |
return true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment