XF 2.2 How to update custom user field?

noxa

Member
We know we can get user custom field value from the '$user' object -

Code:
$facebook_url = $user->Profile->custom_fields->facebook;

We also know we can easily update any user field using 'fastUpdate' method -

Code:
$user->fastUpdate('user_state', "valid");

What is the easiest way to update user custom field value? For example, I want to update the user 'Facebook' field value. How can I achieve that programmatically?
 
Top