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

Mark thread as read for everyone

Discussion in 'XenForo Development Discussions' started by Kerby, Sep 29, 2014.

  1. Kerby

    Kerby Active Member

    I have the same question. Can someone help me please? Propably a SQL Query would help me. Thank you very much.

    I need as soon as possible a solution for this and would donate by paypal for this small help. Probably @skhms knows the answer with his addon Mark Thread as Read?
    Last edited: Sep 29, 2014
  2. skhms

    skhms Active Member

    As far as I know you need to add a read date and thread id for each user in the table xf_thread_read.

    Guess you could do it with something like this.
    OBS! I haven't tried this myself. I haven't got a good test forum running at the moment.
    So if you want to try it please make a backup and all that first.
    INSERT INTO xf_thread_read
        (user_id, thread_id, thread_read_date)
        user_id, xxx, UNIX_TIMESTAMP()
    ON DUPLICATE KEY UPDATE thread_read_date = VALUES(thread_read_date)
    Replace xxx with the thread id.

    This will add every single user though.
    Not sure how long time it will take to execute a query like this on a big board with many users.
    You could always add some kind of filter to only add valid user or something like that.
        xf_user WHERE user_state = 'valid'
    Also, this will not mark the forum as read even if a user has no other unread threads in the same forum as the thread.

    Kerby likes this.

Share This Page