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

XF 1.3 User bans aren't automatically getting lifted

Discussion in 'Troubleshooting and Problems' started by caleb89taylor, Aug 28, 2014.

  1. caleb89taylor

    caleb89taylor Member

    We are having an issue in our test environment (where are are testing our upgrade to Xenforo 1.3.4 from 1.3) where banned users aren't automatically becoming un-banned after their ban deadline. The date in the admin control panel and in the database shows that the ban should have ended at midnight but it does not. The user is still shown as banned in the xf_user table and get the banned message when they login.

    We have custom code and plugins that might be interfering with this. My main question is how is the un-banning handled and when/how is the xf_user table updated? Thanks!
  2. Syndol

    Syndol Guest

    The cron that unbans users (Delete Expired Bans) runs at 45 minutes past the hour (unless this was changed by you at any point).
    For this to work, there must be at least one person browsing the forums.

    When the cron runs, it calls function deleteExpiredUserBans() in class XenForo_Model_Banning
    When the ban is removed (and the user is_banned flag is reset) it calls function removeUserGroupChange() in class XenForo_Model_User which removes the user from the banned user group.

    So, if your ban says it will be lifted at midnight, it will actually only lift once the cron runs which is at 45 minutes past midnight (or as soon as someone views your forum).
    If the ban has not lifted at 46 past the hour then you will want to see if any of your add-ons are extending or overwriting the above mentioned functions.
  3. caleb89taylor

    caleb89taylor Member

    Thanks so much for the reply, that cleared a lot of things up. So I found that manually running the cron job results in a successful clearing of old bans. But it still doesn't work when run "automatically". I manually set the job to run a minute in the future and then waited for it to be past that time but the old bans were not removed. Not sure if this is something that's been seen before on test environments. What could the difference be between running it manually and letting it run automatically?
  4. Syndol

    Syndol Guest

    At least one person (in this case, you, as its a test forum) must be browsing the forum (ie viewing different threads) in order for the cron to be triggered.
  5. caleb89taylor

    caleb89taylor Member

    Hm. Not sure what's happening then. I was browsing the forums and even had another developer on the same box but it still didn't seem to run. Any place I can check logs of what cron jobs ran or errors that happened?
  6. Mike

    Mike XenForo Developer Staff Member

    You can see the dates for the next run in the crons. If they're in the past, then there's an issue. Run the file health check and make sure everything is running as expected there, disable add-ons, and check the browser console for any errors.

Share This Page