https://www.icyphoenix.com/viewtopic.php?f=35&t=8651 ----------------------------------- jhl Fri 24 Aug, 2012 16:23 The 'New' Link And Display Page ----------------------------------- Having updated a web site with IP 2.0.0.86 there are a couple of strange problems with the New link. This also happens on this site - though you'll have to switch stile to Icy Phoenix. If you login and go to the Forum page, the New link shows the number of new topics in parentheses (but not with the default style). In my case it says 'New (20)'. But if I click on the link, it takes me to the search result page which shows 'Search found 10 matches'. It may be that this problem existed in previous releases - I haven't checked. A further problem, though I don't think it is related, is that some users are still seeing threads uin the 'New' page from 14/08/2012 - a couple of days before I upgraded the site. I think this is due to these users not logging out. It doesn't happen to me, because I do log out. In fact, if I log out then log in, the search results page shows 0 matches. Now I know that IP logs people out 'virtually' after a couple of hours, and logs them in again the next time they access the site. I haven't had time to check the code yet, but perhaps someone else has also found these problems? John ----------------------------------- Joshua203 Fri 24 Aug, 2012 17:34 Re: The 'New' Link And Display Page ----------------------------------- Are you sure these aren't 20 posts in 10 threads John? I'm sure there was a big discussion about the new way new posts are handled regarding the new upi2db system and the normal way but I could not find it as fast as I wanted tbh. It had a lot to do with session length and loggin in/out ----------------------------------- jhl Fri 24 Aug, 2012 18:48 Re: The 'New' Link And Display Page ----------------------------------- [quote user="Joshua203" post="56433"]Are you sure these aren't 20 posts in 10 threads John?[/quote] Could well be Joshua. But I wonder why there are two different queries for the same (or similar) information. [quote user="Joshua203" post="56433"]I'm sure there was a big discussion about the new way new posts are handled regarding the new upi2db system and the normal way but I could not find it as fast as I wanted tbh. It had a lot to do with session length and loggin in/out[/quote] If you can find that discussion, I will read it thoroughly, thanks. John ----------------------------------- Joshua203 Fri 24 Aug, 2012 19:37 Re: The 'New' Link And Display Page ----------------------------------- It took me a while :roll: but I guess this is it.. http://www.icyphoenix.com/viewtopic.php?f=10&t=8136&start=0 ----------------------------------- jhl Sat 25 Aug, 2012 13:19 Re: The 'New' Link And Display Page ----------------------------------- [quote user="Joshua203" post="56440"]It took me a while :roll: but I guess this is it.. http://www.icyphoenix.com/viewtopic.php?f=10&t=8136&start=0[/quote] Yes, I think you're right. There seems to be a bit of confusion though. Meanwhile I took a look at the code, which has a few discrepancies... First of all, let's see if I can clear things up a little (or possibly confuse everyone more). [size=14][b]Overview[/b][/size] There are two systems for new/unread/et al messages - cookie based and DB based (UPI2DB). I haven't looked at UPI2DB at all, so I won't mention it further here. The number of new posts appears only in specified pages (all forums and single forum usually) to reduce DB hits, but [i]always[/i] displays the number of new posts since you last logged in (irrespective of using cookies or UPI2DB). So if you want to reduce the list you [b]must[/b] log out, then log in again. Here 'New' refers to posts published after you logged in, even if you've read one or more of the posts. That's just how it is, and that's what I'll explain to my users. New != Unread. [size=14][b]Discrepancies[/b][/size] Now to the discrepancies. I'm making reference to the PHP code, mostly. The 'New' count in the link is calculated using an SQL query (includes/functions.php, line 4539): [code linenumbers=false]$sql = "SELECT COUNT(post_id) as total FROM " . POSTS_TABLE . " WHERE post_time >= " . $user->data['user_lastvisit'] . AND poster_id != " . $user->data['user_id'];[/code] which basically says "get the post counts since you last logged in, that aren't yours". However, in the actual search page, the SQL query is (search.php, line 329): [code linenumbers=false]$sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE post_time >= " . $user->data['user_lastvisit'];[/code] this says "get every post since you last logged in". This will (or should) produce more results, because it [i]will[/i] also include your own posts, whereas the counter didn't. But, then the results page uses the topic format to display the results. This will mean that although there could have been say 20 new posts, if they were all in a single topic, you'll only see one line of results. [size=14][b]Possible alternatives[/b][/size] The first discrepancy is very minor - either add the 'your posts' filter to the search query, or remove it from the count query. I don't see this being a problem. Personally, I'd remove the filter from the count query. The second discrepancy seems more 'conceptual' than mathematical. If New refers to posts, why show the results using the topics format? Wouldn't it be more reasonable to show the results using the posts format? Or, if the results are shown as topics (which displays less information, when there are many new posts), shouldn't the count refer to the number of [b]topics[/b] with new posts? (For those who might not know these two formats, you can choose one or the other in the search panel, see below, where the cursor is) [align=center] [img]http://www.icyphoenix.com/files/images/10300/search.jpg[/img] [/align] Thoughts? John ----------------------------------- Joshua203 Thu 30 Aug, 2012 20:57 Re: The 'New' Link And Display Page ----------------------------------- Well, without getting technical, it's all pretty confusing (even at phpbb as far as i can see) I think if people want accuracy they should use upi2db, for me this is too much as I like to be able to see the new even after I visited them. I also would not want to see 10 posts in 1 thread shown separately either (but i do want to see them counted) ----------------------------------- Mighty Gorgon Mon 10 Sep, 2012 23:45 Re: The 'New' Link And Display Page ----------------------------------- You are right about the discrepancies. At the moment I have added the filter over own posts (I don't want that counter to increase because of my posts) and I have implemented the view of the result following posts instead of topics. I'll have a try and decide if keeping it as is or change again. Thanks for the analysis and reporting. ----------------------------------- jhl Fri 14 Sep, 2012 13:52 Re: The 'New' Link And Display Page ----------------------------------- [quote user="Mighty Gorgon" post="56751"]You are right about the discrepancies. At the moment I have added the filter over own posts (I don't want that counter to increase because of my posts) and I have implemented the view of the result following posts instead of topics. I'll have a try and decide if keeping it as is or change again. Thanks for the analysis and reporting.[/quote] Let (us) me know if this added to the latest release... John ----------------------------------- Mighty Gorgon Sat 15 Sep, 2012 11:52 Re: The 'New' Link And Display Page ----------------------------------- Yes, I have to finish to mess up with the code and I will update GIT.