Skip to content

Instantly share code, notes, and snippets.

@exside
Forked from splittingred/prehook.profile.php
Created March 2, 2013 20:45
Show Gist options
  • Save exside/5073196 to your computer and use it in GitHub Desktop.
Save exside/5073196 to your computer and use it in GitHub Desktop.
<?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