AndyB
Well-known member
How to get value of xf_user_profile.custom_fields using finder?
I currently do this with the following MySQL query:
I then get the data with this code:
$customFieldsArray = json_decode($custom_fields, true);
Now when I try to use the finder:
and try to get the value using:
I get back an object. How would I get the value of the custom_fields?
Thank you.
I currently do this with the following MySQL query:
PHP:
$custom_fields = $db->fetchOne("
SELECT custom_fields
FROM xf_user_profile
WHERE user_id = ?
", $userId);
I then get the data with this code:
$customFieldsArray = json_decode($custom_fields, true);
Now when I try to use the finder:
PHP:
$finder = \XF::finder('XF:UserProfile');
$userProfile = $finder
->where('user_id', $userId)
->fetchOne();
and try to get the value using:
PHP:
$customFields = $userProfile->custom_fields;
I get back an object. How would I get the value of the custom_fields?
Thank you.