XF 2.2 update a custom field

synpres

Member
I want to update my custom field I made through a discord bot, nothing I've tried seems to work when I update it, headers & url is proper, I can get the fields just fine as they return the proper value when I console log it, but when I actually try to change the value it just doesn't work
1661131242761.png


I feel like this might be a silly question but I've honestly been stumped for a while on this, any help is appreciated.
 

Hoffi

Well-known member
The values are stored twice, thats the issue. If you update them in the field_values table, thats not enough.

If you change the value in the table, just call from the userField Repository the function
rebuildUserFieldValuesCache with the userid.

$UserFieldRepo->rebuildUserFieldValuesCache(UserId);
 
Top