XF 2.1 Threads not opening at first unread. Opening at the first page. Need help to fix this.

Stuart Wright

Well-known member
I'm getting multiple reports that threads aren't opening at the first unread post, but at page 1, post 1. The new posts were posted today. Do you know of anything that could be causing this? Anything I can look out for?
Thanks.
 
I don't think it's quite as simple as this. Based on my own experience and from reading user reports
1: The misbehaviour is not confined to "first unread". Other cases where one should be taken (scrolled) to a specific post - links in alerts (eg for "likes") for example, and links provided by the Checkpoint Add-On - also misbehave similarly
2: It's not page 1, post 1. It's the top of the page in which the intended post (first unread, liked etc) appears.
3: And it's seemingly random - by which I mean, it doesn't happen all the time - maybe 30-50%, and I can't establish a pattern. It's not dependent on which node its in; it's not dependent on the type of user; it's not dependent on whether the read/unread was set by actually reading, by marking a node read, nor by the age of the post etc.

In other words it seems to be a general misbehaviour of certain point in a page* indexing.

* Sorry - don't know the tech term; it's where a page should display partly scrolled to a given index point.

EDIT I gather the term is "Anchor".
 
Last edited:
What browser are you using?

Could your problem be related to these threads?



 
I know the issue I linked to affects Firefox and Chrome - and probably Edge as well. I'm not sure about Safari. And of course your issue may be caused by something else.
 
I just noticed this myself today.

Not sure what exactly happened, but I used links to new posts from widget (have set it up to show unread posts).

As I didn't expected this to happen, didn't checked how links where actually formed, just clicked them to open in new tabs (ctrl+click on link) to read new posts. Well, some of them opened on first posts instead first unread.

So, I would check if you have widget for new posts, or you use some other way to get list of new posts. I never noticed that when I used "new posts" navigation link, only now with widget.
 
What browser are you using?

Could your problem be related to these threads?



I don't think it's any of these.
 
If you go to the top of page 1, that means that we have no read marking data for you for that thread (and nothing from the forum). Thus we will take you to the first post in the thread. This is controlled by the "Read marking data lifetime" option. It is possible you have read the thread before, but it the last time would've been more than <that lifetime value> ago, so we no longer have the data tracked.
 
It is possible you have read the thread before, but it the last time would've been more than <that lifetime value> ago, so we no longer have the data tracked.
Will in this case still be possible to "go to first unread"? As this happened to me, even if I was positioned at first page of very old thread (in sense, started long time ago, but had new posts recently), I could go to first unread posts.
 
If you go to the top of page 1, that means that we have no read marking data for you for that thread (and nothing from the forum). Thus we will take you to the first post in the thread. This is controlled by the "Read marking data lifetime" option. It is possible you have read the thread before, but it the last time would've been more than <that lifetime value> ago, so we no longer have the data tracked.
Read marking data lifetime is set to 30 days and the threads have had replies more recently than that. In some cases, earlier in the same day.
 
I'll say again - I doubt it has anything to do with Unread (unless there are several separate issues occurring).
It is also happening with the link in
  • an alert (eg for a "liked" post)
  • the "unchecked" marker provided by our CheckPoint Add-On
Clearly "unread" is the more likely type of link that demonstrates, but I believe it's a red herring.
 
I'll say again - I doubt it has anything to do with Unread (unless there are several separate issues occurring).
It is also happening with the link in
  • an alert (eg for a "liked" post)
  • the "unchecked" marker provided by our CheckPoint Add-On
Clearly "unread" is the more likely type of link that demonstrates, but I believe it's a red herring.
So really it's a case of in-page post anchors randomly not working? How the hell do we diagnose that problem?
 
Will in this case still be possible to "go to first unread"? As this happened to me, even if I was positioned at first page of very old thread (in sense, started long time ago, but had new posts recently), I could go to first unread posts.
The "jump to new" link shown within the thread will explicitly take you to the first post that is labeled as "new".

Read marking data lifetime is set to 30 days and the threads have had replies more recently than that. In some cases, earlier in the same day.
It's not exactly about the date of the last reply, but the date the thread was last read by the user in question. If they visited the thread earlier in the day, someone posted a reply and they returned, it should have attempted to take them to that reply. If they haven't visited the thread in more than <read marking lifetime> days, even if there have been 20 replies in that time, it'll take them to the start of the thread by default because there's no data tracked to indicate that they've read the thread. Increasing the cutoff will maintain the data for longer (though admittedly, going particularly high could introduce some performance concerns as it expands the window in which certain things are checked).

So really it's a case of in-page post anchors randomly not working? How the hell do we diagnose that problem?
Well one issue right now is that there are conflicting descriptions of the problem. My reply is specifically based on the "top of page 1" situation (ie, it's not taking you to a post at all). If it takes you to the top of any subsequent page, that would be a distinct issue (and not one we've seen). If it takes you to the correct post initially and then the page shifts around, that is what the linked threads relate to (though at this point, in the current term, there isn't much more we can do and browsers have generally adopted systems that should help mitigate this internally).

When the issue happens, look at the URL you're at. Is there an anchor in the URL? (#post-1234) If so, it's not the read marking issue. Has it scrolled you anywhere down the page but you're not looking at the correct post? It's probably images shifting the page around, as discussed in some of the linked threads. Is there an anchor but you're at the top of the page? Well that's weird and might indicate that the actual anchor elements aren't present in posts for some reason or there's something else custom causing issues.
 
Using either Firefox or Edge, I can make the following happen randomly* in all of the following contexts. All of these intend to open a page and then scroll it to a post partway down:

1: URL in an alert ...../posts/nnnnnnn/
2: The post number on a post partway through a thread ........threads/name.nnnnnn/post-nnnnnnn
3: Unchecked Count .........threads/name.nnnnnn/first-unchecked (from an Add-On)
4: and .......threads/name.nnnnnn/unread

and all of these see the correct PAGE opened, but it either is, or is not, scrolled to the required point.

There may be other instances where the intended target is a post partway down a page I haven't yet thought of

I can make these happen
  • using middle-click (to open a new tab)
  • pasting the INPUT URL into a blank tab and pressing Enter
  • right-click and open in new tab
but I have not been able to recreate it at all using
  • a conventional left-click to open the URL in the same window/tab
  • right click and open in a new window

In all of these cases, the INPUT URL is not the same as that shown in the location bar after the page is displayed. The shown URL is the same whether it scrolled correctly or not.

HTH

* I appreciate that's an unhelpful term. I use it simply because repeating exactly the same process produces a page that is either correctly scrolled or not.
 
The "jump to new" link shown within the thread will explicitly take you to the first post that is labeled as "new".
If you read everything I wrote, you'd know that I'm aware of that. And I was just trying to help solve this issue (if it is an issue) by informing you that I still had option to go to first unread posts, even if I landed on first posts of threads when I tried to open them at first unread posts.

You know, you mentioned one scenario which may trigger something like this, but I was a bit unsure if in case of your scenario we would be able to use go to first unread posts.
 
Ok, this appears to be an issue caused by the Quantcast Choice script.
Opening a URL which scrolls to an anchor (a specific post) down the page does not scroll some of the time.
It happens with /latest links and it appears to strip the #post-nnnnnn element off the end of the landed URL.

The code we're currently using is
JavaScript:
<!-- Quantcast Choice. Consent Manager Tag v2.0 (for TCF 2.0) -->
<script type="text/javascript" async=true>
!function(){var t=window.location.hostname,e=document.createElement("script"),a=document.getElementsByTagName("script")[0],n="https://quantcast.mgr.consensu.org".concat("/choice/","v88e89CxF10j2","/",t,"/choice.js"),i=0;e.async=!0,e.type="text/javascript",e.src=n,a.parentNode.insertBefore(e,a),function(){for(var t,i="__tcfapiLocator",n=[],o=window;o;){try{if(o.frames[i]){t=o;break}}catch(t){}if(o===window.top)break;o=o.parent}t||(!function t(){var e,a=o.document,n=!!o.frames[i];return n||(a.body?((e=a.createElement("iframe")).style.cssText="display:none",e.name=i,a.body.appendChild(e)):setTimeout(t,5)),!n}(),o.__tcfapi=function(){var t,e,a=arguments;if(!a.length)return n;"setGdprApplies"===a[0]?3<a.length&&2===a[2]&&"boolean"==typeof a[3]&&(t=a[3],"function"==typeof a[2]&&a[2]("set",!0)):"ping"===a[0]?(e={gdprApplies:t,cmpLoaded:!1,cmpStatus:"stub"},"function"==typeof a[2]&&a[2](e)):n.push(a)},o.addEventListener("message",function(n){var i="string"==typeof n.data,t={};try{t=i?JSON.parse(n.data):n.data}catch(t){}var o=t.__tcfapiCall;o&&window.__tcfapi(o.command,o.version,function(t,e){var a={__tcfapiReturn:{returnValue:t,success:e,callId:o.callId}};i&&(a=JSON.stringify(a)),n.source.postMessage(a,"*")},o.parameter)},!1))}();var o,s=function(){var t=arguments;typeof window.__uspapi!==s&&setTimeout(function(){void 0!==window.__uspapi&&window.__uspapi.apply(window.__uspapi,t)},500)};void 0===window.__uspapi&&(window.__uspapi=s,o=setInterval(function(){i++,window.__uspapi===s&&i<3?console.warn("USP is not accessible"):clearInterval(o)},6e3))}();
</script>
<!-- End Quantcast Choice. Consent Manager Tag v2.0 (for TCF 2.0) -->
I've disabled it temporarily while we feed this back to them.
Having a cookie acceptance system is compulsory of you have advertising which uses the major networks, so we have no choice but to use it.
It would be interesting to know whether other Xenforo forums are having this same issue.
 
Last edited:
I get this on here sometimes. Happened last night when on my phone. Browsing new, saw a thread with unread posts that I'd not visited in a while and it opened up the first page instead of going to the latest unread post.

It's very annoying an makes it feel buggy. Not sure why that data can't be kept for a very long time or indefinitely by default so it 'just works' all the time. It's weird that you can still click the first unread post and it then jumps to the right post though.
 
Is there a description / explanation of how this system works at xenforo? Our users are still a bit confused because they were used to vB3 being automatically directed to the last post in a thread from the start page.

Best regards.
 
Top Bottom