
Re: The 'New' Link And Display Page
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).
Overview
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
always 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
must 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.
Discrepancies
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):
$sql = "SELECT COUNT(post_id) as total FROM " . POSTS_TABLE . " WHERE post_time >= " . $user->data['user_lastvisit'] . AND poster_id != " . $user->data['user_id'];
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):
$sql = "SELECT post_id FROM " . POSTS_TABLE . " WHERE post_time >= " . $user->data['user_lastvisit'];
this says "get every post since you last logged in".
This will (or should) produce more results, because it
will 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.
Possible alternatives
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
topics 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)
Thoughts?
John
Edited by
Joshua203, Sat 25 Aug, 2012 13:58: bbcode FONT replaced by bbcode CODE tags