Page 5 of 9

Re: New post count on index

Posted: Thu Jan 03, 2008 3:58 pm
by Tom@S
thx moifest i will look on it.You mean that is enough to add some queries ?

Re: New post count on index

Posted: Thu Jan 03, 2008 4:21 pm
by moifest
There is another MOD that displays unread posts here: http://www.phpbb.com/community/viewtopic.php?p=3015775

Obviously it is slightly different but once an unread post is viewed, it is removed from the list.

I have this MOD running on my board as my member prefer too be able to link straight to new unread posts. Once read its no longer on their list.

Re: New post count on index

Posted: Thu Jan 03, 2008 4:28 pm
by Tom@S
great thx i will look on it inmediatelly because i looking in this query and get headakes :)
edit/i looked on it and it is not very similar mod it show only if is new pist or not

Re: New post count on index

Posted: Thu Jan 03, 2008 9:32 pm
by Tazmanian
I have this mod running on my forum. But i just figured out this 'problem'.

If somebody post a new message or topic in a private forum it also count for the new post count on index mod. So for example, there is 1 new post, but if the user has no permissions to view that post there are no new message available. Althought, on the index stand that there is one new message.

Do you understand? Sorry, i can't explain it wel in English. :oops:

Re: New post count on index

Posted: Thu Jan 17, 2008 8:45 pm
by bardosoft
Hi great mod.

;)

Re: New post count on index

Posted: Tue Feb 12, 2008 3:48 am
by Sascha Mueller
This mod is for RC7. Do you plan to release an new version for 3.0.0?

Re: New post count on index

Posted: Tue Feb 12, 2008 5:25 pm
by lefty74
works fine on gold for me :)

Re: New post count on index

Posted: Tue Feb 12, 2008 10:47 pm
by Jaymie1989
After seeing all the problems that people have had.

Is this now working with GOLD and files are updated?

Re: New post count on index

Posted: Sat Feb 16, 2008 4:12 pm
by bsoder
My setup is working now - I'm using this query, which indicates the correct unread post count now. I just replaced the sql query in index.php (actually in includes/functions.php per the first page or two of this thread) with this.

$sql = 'SELECT count(*) as count FROM (
SELECT t.topic_id, t.topic_last_post_time tlpt ,tt.mark_time as tmt, ft.mark_time as fmt, u.user_lastmark as umt
FROM ' . USERS_TABLE . ' u, ' . TOPICS_TABLE . ' t
LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON tt.topic_id = t.topic_id AND tt.user_id=' . $user->data['user_id'] . '
LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON ft.forum_id=t.forum_id AND ft.user_id=' . $user->data['user_id'] . '
WHERE u.user_id= ' . $user->data['user_id'] . ' AND topic_last_post_time > u.user_lastmark
) marktimes
WHERE 1 AND NOT ((tlpt <= tmt AND NOT ISNULL(tmt)) OR (tlpt <= fmt AND NOT ISNULL(fmt)))';

Re: New post count on index

Posted: Sat Feb 16, 2008 6:31 pm
by manchumahara
bsoder wrote:My setup is working now - I'm using this query, which indicates the correct unread post count now. I just replaced the sql query in index.php (actually in includes/functions.php per the first page or two of this thread) with this.

$sql = 'SELECT count(*) as count FROM (
SELECT t.topic_id, t.topic_last_post_time tlpt ,tt.mark_time as tmt, ft.mark_time as fmt, u.user_lastmark as umt
FROM ' . USERS_TABLE . ' u, ' . TOPICS_TABLE . ' t
LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON tt.topic_id = t.topic_id AND tt.user_id=' . $user->data['user_id'] . '
LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON ft.forum_id=t.forum_id AND ft.user_id=' . $user->data['user_id'] . '
WHERE u.user_id= ' . $user->data['user_id'] . ' AND topic_last_post_time > u.user_lastmark
) marktimes
WHERE 1 AND NOT ((tlpt <= tmt AND NOT ISNULL(tmt)) OR (tlpt <= fmt AND NOT ISNULL(fmt)))';
Thanks.. it works for me. I was looking for this for many days.

Re: New post count on index

Posted: Sat Feb 16, 2008 7:01 pm
by bsoder
Welcome. It's not my query, it was in another thread here somewhere - not directly related to post counts, but close enough.

Re: New post count on index

Posted: Sat Feb 16, 2008 9:17 pm
by bardosoft
demo, please

Re: New post count on index

Posted: Sun Feb 17, 2008 2:11 pm
by bsoder
The SQL I posted doesn't reflect the actual number of new posts, it reflects the number of new topics. I've changed the text in language/en/common.php, the SEARCH_NEW value, to read "View new topics" on my board. I like topic count better than post count anyway, but just so you all are aware of the difference.

Re: New post count on index

Posted: Tue Feb 19, 2008 10:29 am
by -.-PhanTom-.-
bsoder wrote:The SQL I posted doesn't reflect the actual number of new posts, it reflects the number of new topics. I've changed the text in language/en/common.php, the SEARCH_NEW value, to read "View new topics" on my board. I like topic count better than post count anyway, but just so you all are aware of the difference.
Nice one. But it is not working 100% for me. It is not updating the number/count as it should...

Would it be possible to change the query to show new topics since last page refresh instead of last login?

Also, is it possible to add a new variable "SEARCH_NEW_TOPIC" instead of altering the text for SEARCH_NEW n language/en/common.php?
If so, I guess I have to somehow add this new variable in index.php or somewhere else?

Re: New post count on index

Posted: Tue Feb 19, 2008 9:47 pm
by bsoder
I think the problem comes from the fact that the newposts query in search.php for threads uses user_lastvisit to key on, rather than a similar query to the one I posted. So what happens is that the query I posted will show you a count of all threads in the system that you've never viewed, but the query when you click on the link is showing active threads since your last login.

At the moment, I'm experimenting with replacing the query in search.php, around line 375 or so. Here's the query I'm trying.

$sql = 'SELECT t.topic_id
FROM ' . USERS_TABLE . ' u, ' . TOPICS_TABLE . ' t
LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON tt.topic_id = t.topic_id AND tt.user_id=' . $user->data['user_id'] . '
LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON ft.forum_id=t.forum_id AND ft.user_id=' . $user->data['user_id'] . '
WHERE u.user_id= ' . $user->data['user_id'] . ' AND topic_last_post_time > u.user_lastmark
AND NOT ((t.topic_last_post_time <= tt.mark_time AND NOT ISNULL(tt.mark_time)) OR (t.topic_last_post_time <= ft.mark_time AND NOT ISNULL(ft.mark_time)))';