XF 2.0 Get customfields in a controller

Hi,
thank you for your answer.

The issue is that I have this code in my controller

$userid= 52; //for example
$userFinder = $this->finder('XF:User');
$user = $userFinder
->with('Option', true)
->with('Profile', true)
->where('user_id', $userid)
->fetchOne();
$name = $user.Profile.custom_fields.name;


But I get

ErrorException: Use of undefined constant Profile;

When I search for custom fields I have them in this format.
001.webp

How can I get them as an object?
Thanks!
 
Sorry, I gave you the template syntax. It'd just be $user->Profile->custom_fields->name.
 
Top Bottom