Output User Profile Information from specific User Group

I just turned this up:

I’d switch line 20 to foreach($users as $user) and then you should be able to use something very similar to it.

$username = $user->get('username');
$photo = $user->getOne('Profile')->get('photo');

Profiles are effectively split into two tables. Username is part of the ‘user’ table and ‘photo’ is part of the profile. It appears you’re querying the profile for the username above which would have lead to nothing being returned.

Here’s a breakdown of fields to help with what should come from which part of the user object (‘core’ vs ‘profile’): https://docs.modx.com/revolution/2.x/administering-your-site/security/users

1 Like