I have a custom user field 'myuserfield'
How do I save a value to this field via a plugin in Craft3?
Here is my current attempt.
$myvar = '12345'; Craft::$app->getUser()->getIdentity()->setFieldValue('myuserfield', $myvar); $myid = Craft::$app->getUser()->getIdentity()->getFieldValue('myuserfield');
When I echo $myid it does, in fact, give me the new value ($myvar or 12345) but when I check the control panel the value is not saved.