SK Mark Thread as Read

SK Mark Thread as Read 2.0.0

No permission to download

skhms

Active member
skhms submitted a new resource:

SK Mark Thread as Read - Allow users to mark a thread as read without actually viewing the thread.

SK Mark Thread as Read - v2.0.0

Allow users to mark a thread as read without actually viewing the thread.

Description
A 'Mark as Read' link will appear on the forum list, watched threads, unread threads and the recent threads pages.

Click the link and the thread will be marked as read without you needing to open it.

Those with permission to do inline moderation can as an alternative select threads and choose 'Mark Threads as Read' using the inline moderation pop-up.

The...

Read more about this resource...
 
Can someone confirm that this is still working as intended for them using the latest XF version? For some reason I only see the option to mark as read on a handful of threads in each forum, even when using a test account that I haven't viewed any threads on in some forums.
 
I have tested it on Xenforo 2.0.4 and can't see any issues.

Remember that posts older than 30 days (that's the default value, you can change it) is automatically considered as read.
So even if you register a new account some older threads will be marked as read and no "Mark as Read" link will be shown.

/SK
 
That's some coincidental timing, because I was just coming here to say that this seems to have sorted itself out.

The issue I was reporting included threads newer than thirty days. For one thing, I was seeing it on the new posts page. But I was just going over those and the forums a few minutes ago and everything looks good now. So I'm not sure exactly what cron had to run, or whatever, but it seems to be working fine now, which is all I care about. Thanks for the reply. (y)
 
@skhms Please can you add functionality, Mark Thread as Un-Read? When make Mark Thread as Read then appear button Mark Thread as Un-Read.
 
Hi @skhms, no idea if you still monitor this, but is there a code modification I could make that would reload the forum index instead of redirecting to the last post inside the thread?

Thanks!
 
Hi @skhms, no idea if you still monitor this, but is there a code modification I could make that would reload the forum index instead of redirecting to the last post inside the thread?

Thanks!
I don't understand why you are redirected inside the thread in the first place.

You're not supposed to be directed anywhere. The thread should just be marked as read and you are supposed to stay on that page.
Just tried it on the latest XF version (2.1.3) and for me it still works as expected with no redirection.

/SK
 
Hey, thanks for getting back to me, didn't think I'd hear from you. Yeah, I didn't understand that either and assumed it was a bug. Weird.

I know just enough php to be dangerous, but it looks like there is a redirect being used; does the null value cause it to reload the current screen?

So we either have a config problem or an addon conflict, I guess. I'll keep playing with it. Thanks for getting back to me, that is super helpful to know!
 
I see that I actually do have a redirect to the thread page in the code.

But that redirect should only happen if it isn't a valid user that tries to mark a thread as read.
Like a guest, someone not logged in.
It's a check I do since the function that does the actual work of marking a thread as read must have a valid user to work,

Not sure how that could happen though.
The Mark as Read link should not be visible if it isn't a valid (logged in) user.

/SK
 
That makes perfect sense. I'm using it logged in as an admin, and I've had registered users ask me about the redirect so it's doing that users who are logged in.

It looks like this is all happening here:

Code:
                if( !\XF::visitor()->user_id )
                {
                        return $this->redirect($this->buildLink('threads', $thread));
                }

                $thread->markAsRead($this->filter('time', 'uint'));

                return $this->redirect($this->getDynamicRedirect(null, true), \XF::phrase('sk_thread_marked_read'));

Should the null value in getDynamicRedirect cause it not to actually redirect?

I appreciate your time with this.
 
I am bit rusty on this...
The getDynamicRedirect function should figure out your current page and makes you return to it.
Instead of the null value you can submit a fallback url if it would fail for some reason. Null seems to be the same as use the index page as the fallback url.

I believe more in the theory that XF::visitor()->user_id variable for some reason isn't set anymore and you are redirected to threads page that way.

/SK
 
Back
Top Bottom