Re: Topic paging issue
Here’s a simplified example of what I think is happening internally.
Let’s say for ease of understanding there are TWO posts per page.
And there are 7 posts in this particular topic example
|1 2
| – |3 4
| – |5 6
| – |7
|
so there are 4 pages (each | | is a page)
In this example, the post numbers are also the post-position.
Now let’s say a mod deletes post number 4
|1 2
| – |3 5
| – |6 7
|
Should only be three pages.
But bbPress is stupid by default, post-position is never recalculated so those post numbers still represent post position in this example.
bbPress DOES track number of posts in a topic, even when deleted.
So requesting a link to the last post in the topic, regardless of post-position, WILL be calculated correctly, and return page 3.
However, if it specifically asks for a direct link to post 7 and not the last post in the topic, this is what happens.
Post 7 is post-position 7
posts per page is 2 per page
ceil( $post_position / $per_page )
7 / 2 = 3.5, ceil of 3.5 = 4
So it will ask for page 4
Page 4 does not exist in the topic.
The link may be created but the link is bogus and will not work, it will either return you to the first page of the topic, or maybe the front page of the entire forum.