Discussion in 'XenForo Development Discussions' started by Mic, Apr 4, 2013.
How can I get a user custom field value in php?
It's in the user record.
What is the context? Are you working with a XenForo addon? Or are you talking about a raw PHP script that is separate from XenForo?
Inside my add-on.
I found a way to get the value.
$userFieldModel = new XenForo_Model_UserField;
$values = $userFieldModel->getUserFieldValues($visitor['user_id']);
$myValue = $values['my_custom_field_id'];
You shouldn't instantiate XenForo_Model_UserField directly. It should be:
Separate names with a comma.