• 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

Kerby

Active member
#1
Is there a way to mark a single thread as read for all users? Perhaps a database query?
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:

skhms

Active member
#2
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.
Code:
INSERT INTO xf_thread_read
    (user_id, thread_id, thread_read_date)
SELECT
    user_id, xxx, UNIX_TIMESTAMP()
FROM
    xf_user
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.
Code:
FROM
    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.

/SK