-
- 24,544 Posts
Try something like this:
$output = '';
$c = $modx->newQuery('modUserProfile');
$c->where(array(
'comment:LIKE' => '%something%',
));
$profiles = $modx->getCollection('modUserProfile', $c);
if (empty($profiles)) {
$output = 'No Users Found';
} else {
foreach($profiles as $profile) {
$user = $profile->getOne('User');
$userFields = $user->toArray();
$profileFields = $profile->toArray();
/* Associative array of all user fields */
$allUserFields = array_merge($profileFields, $userFields);
/* Do something with the user fields here, e.g.: */
$output .= $modx->getChunk('MyUserTplChunk', $allUserFields);
}
}
return $output;
-
- 24,544 Posts
Glad I could help.