XF 2.1 How to rebuild the custom field cache?

Matt C.

Well-known member
In one of my add-ons, I am programmatically adding new custom fields. @Chris D said I need to rebuild the custom field cache after doing this.


How would do this? Thank you.
 
Is it this?

PHP:
public function rebuildUserFieldValuesCache()
{
    $this->repository('XF:UserField')->rebuildUserFieldValuesCache($this->user_id);
}
 
The exact method to call would depend on the type of field being created, but since they all build from the same core system, the method is called rebuildFieldCache and you'd call it on the correct field type's repository.

For example, for custom user fields:
Code:
\XF::repository('XF:UserField')->rebuildFieldCache();
 
Back
Top Bottom