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

Implemented Prune Unread Alerts

Discussion in 'Closed Suggestions' started by digitalpoint, Sep 26, 2013.

  1. digitalpoint

    digitalpoint Well-Known Member

    It would be useful to have an option to prune unread alerts after a certain amount of time.

    Just noticed that I have some users with over 10,000 unread alerts because they are watching some very active forums, but they haven't visited the forum in over a year (their watched forum settings were imported from vB in case you are wondering how they are watching a forum for longer than the feature has been there).

    I have hundreds of users with over 1,000 unread alerts due to the same issue.

    How useful is an alert really to the user when the alert is from 6 months prior? And for scaling purposes, when you have someone getting alerts for every thread (or in some cases every post) in a forum for years and years when they don't visit the site any longer is going to end up with a lot of records in your database if you use XenForo for like 100 years or so.
     
    principia likes this.
  2. Mike

    Mike XenForo Developer Staff Member

    It should be doing that already:
    Code:
            XenForo_Model::create('XenForo_Model_Alert')->deleteOldReadAlerts();
            XenForo_Model::create('XenForo_Model_Alert')->deleteOldUnreadAlerts();
    The former deletes them a certain amount of time after you've viewed them, the latter deletes them 30 days after they were sent (if you haven't viewed them).

    Are you looking at the alert count in the user table or the actual alerts? (We don't update the count when pruning unread alerts.)
     
  3. DBA

    DBA Well-Known Member

    Is there a way to change the number of days? Or at the very least tie it to the "Read Marking Data Lifetime (Days)" option. Which now that I think about it, that would make sense as it's sort of pointless to keep an alert for a thread that's already marked read (even if you haven't actually viewed it).
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    To change the date, you need to edit the file currently and change 30 to the number of days.
     
  5. digitalpoint

    digitalpoint Well-Known Member

    Okay yeah... ignore this suggestion. :) Just checked the guy with 10,000+ alerts on his counter... there's only 2,488 in the alert table... the oldest from 30 days ago. So it's working as designed. :)
     

Share This Page