Hi,
I have the following code in a loop:
$c = $modx->newQuery(’modUserProfile’);
$c->where(array(’internalKey’=>$userInfos->get(’id’)));
$contactInfos = $modx->user->getOne(’Profile’,$c);
$userInfos->get(’id’) value changes in the loop but $contactInfos is always returning the infos of the first profile found in the DB even if $userInfos->get(’id’) changes.
any suggestions?
thanks
No $userInfos is a custom Object.
If I’m understanding what you’re trying to do, $modx->user won’t ever change (it’s you) so you’re always going to get the same user profile.
Get the user object first with $modx->getObject(’modUser’,$userInfos->get(’id’));
FYI, you can add extra fields to the regular user Profile extended fields, so you don’t necessarily have to create a custom DB table or any new objects. I haven’t used them, but I believe the Login package now comes with snippets to display and change user info in the Profile.
so simple! I’m spending so much time to figure simple stuff on Revo!
Thanks a lot!