Firefox PHP

New Count module

Posted by Panu 
New Count module
September 01, 2004 03:08AM
This module displays how many new messages the thread in question has (not just the "new" text).

Usage:

unzip to mods-directory, add your "new" strings if you want and enable in Control center.

edit: 13.5.2005 v. 1.7, shows the total number of new messages if wanted (is there an easier way?) look for the file later on this thread

---
-=[ Panu ]=-



Edited 2 time(s). Last edit at 08/24/2006 09:00AM by mmakaay.
Attachments:
open | download - new_count-1-1.zip (1.4 KB)
Re: New message count next to "new" in list view
September 01, 2004 07:51AM
Ok this is not working correctly after all...

The problem is that
$PHORUM['user']['newinfo']['min_id']

is not updated (at least in my Phorum)

So the value I get from the var stays the same even if I have read all messages?

I may have had some unsuccessfull upgrades during the years, so maybe someone with more knowledge should look into it. My Phorum may not work 100%

So am I understanding the concept wrong or is there something I didn't understand otherwise correctly.

query I'm using to get the not read message count is for example:

SELECT count(*) FROM p5_messages WHERE thread = 4959 and message_id > 4949

but the last var ($PHORUM['user']['newinfo']['min_id']) newer changes.

That is ofcourse the first row in my user_newflag table for the user_id in question.

---
-=[ Panu ]=-
Re: New message count next to "new" in list view
September 01, 2004 08:45AM
I don't know how you understand the concept.

sure, min_id changes if the "mark all read" is used or the newflag-count reaches a given number (defined in constants.php). all messages below min_id are assumed as read anyway.
otherwise the newflags hold an array of messages read which are newer than min_id.
(so newflags is really the wrong word, as it should have been called read-flags then)
so your query would need to be:

SELECT count(*) FROM p5_messages WHERE thread = 4959 and message_id NOT IN(<ids from newflags>) and message_id > min_id

I don't think that will use a key though.
Don't know why you need that query anyway ... the first message of a thread holds all the message-ids of the thread and newinfo is loaded always in the read-page/list-page ... so you should be able to compute the numbers from the info available already.


Thomas Seifert
Re: New message count next to "new" in list view
September 01, 2004 09:47AM
Ok, thanks for the info. Without documentation all fields that could be helpfull are not easy to find.

So I could just count array-items that are not present in newinfo. (or something like that)

I'll try to make v. 1.02 of the script later this evening, thank you for your assistance.

---
-=[ Panu ]=-
Re: New message count next to "new" in list view
September 01, 2004 01:58PM
Yet another version. No sql this time.

I think I f..ed up my newsflag table so I can't test this properly for now.

if someone is interested in giving feedback, then please do so.

---
-=[ Panu ]=-
Attachments:
open | download - new_count-1-2.zip (1.3 KB)
Re: New message count next to "new" in list view
September 01, 2004 06:31PM
Just blank your new flag table to get it to reset. There is nothing in there than can not be killed off.

You should be able to simply check for ids in the threads id list that are A) not in the users read list and B) are greater than min_id. Those are the new ones.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: New message count next to "new" in list view
September 02, 2004 03:13AM
Thankyou for your suggestion, actually I already did that and it helped (for some reason) :) Downside was that I found yet another oversight (bug) in my code.

A new version is coming...
Final version?
September 02, 2004 07:25AM
It finally seems to work ok in different cases in my box, so propably you may have better success with this final? version.

---
-=[ Panu ]=-
pat
Re: Final version?
September 02, 2004 04:28PM
Hi Panu,

> you may have better success with this final? version.

Where is the file ?

thanx
pat
Re: New message count next to "new" in list view
September 02, 2004 05:52PM
Hmm, I'm sure I attached it... well here it is anyway.

---
-=[ Panu ]=-
Attachments:
open | download - new_count-1-3.zip (1.5 KB)
Sorry, only registered users may post in this forum.

Click here to login