My module is printing a block with this count. The count is inaccurate after some messages change status because the static stores the incorrect count before the messages are changed.

Patch incoming.

Comments

te-brian’s picture

Status: Active » Needs review
StatusFileSize
new871 bytes

Here's the patch.

te-brian’s picture

Keep in mind that patch only 'resets' the value for the current $account. This is desirable for me because I'd rather leave the static values in place for other users.

However, it may be more 'standard' to clear the whole variable.

te-brian’s picture

StatusFileSize
new1.77 KB

Based on some IRC feedback, I changed the $reset flag so it clears the whole array of counts.

Also, I added two resets: One for when a message changes status and another for when a thread changes status.

I don't feel a clear is necessary in _privatemsg_send() because the user who sent the message will not receive an unread version of it (afaik).

These clears may move depending on what is committed in #1054082: Allow modules to respond to a status change.

te-brian’s picture

StatusFileSize
new679 bytes

Re-rolled and also removed the resets (per IRC discussion).

berdir’s picture

Status: Needs review » Fixed

Commited, thanks!

No need to port to D7, thanks to drupal_static_reset().

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.