1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.1 Rebuilding User Caches

Discussion in 'Troubleshooting and Problems' started by NDM, Dec 31, 2012.

  1. NDM

    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?
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
    Jake Bunce likes this.
  3. NDM

    NDM Member

    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 :)
     

Share This Page