XF 1.1 Rebuilding User Caches

NDM

Member
I am updating member groups outside of XF and the problem is that I need to rebuild the user caches to make things work. If I upgrade the user group and, for example, allow group 1 not to vote on polls but want to allow group 2 to vote in polls, then group 2 cannot vote until the user caches are updated.

Example:
Group 1 cannot vote on polls by default

My external script changes the group id in my mysql database to Group 2 which is allowed to vote on polls.

However, after the group id has changed, it still shows the old user title and the user is still not able to vote until I run the rebuild user caches feature from the admin cp.

Is there any trick to make it so a cronjob or something else updates the user caches every hour or so?
 
All you need to do is to get your external script to call the Permission Model and rebuild its cache.

PHP:
XenForo_Model::create('XenForo_Model_Permission')->rebuildPermissionCache();

Just get it to run straight after any changes are made. It isn't system intensive and should run near instantly.
 
I am using the DarkKotomi system where you can add custom php pages - Do you think it would work if I just added that piece of code there and call the page by cron? I guess I will just try and find out myself.

Thank you for your help. I'll see how that goes :)
 
Back
Top Bottom