At the privatemsg 5.x - 3.0 module it shows some new messages at menu ("Inbox (xxx)") even though there's no unread messages in the Inbox. It does count of messages by the whole privatemsg table at line 2101:
function _privatemsg_get_new_messages($uid = 0) {
...
$cache[$uid] = (int)db_result(db_query('SELECT COUNT(*) FROM {privatemsg} WHERE recipient = %d AND newmsg = 1 AND recipient_del = 0', $uid));
...
}
but it looks for unread messages only for users that are exist at line 713:
function privatemsg_list($uid = NULL) {
...
$sql1 = "SELECT id, subject, p.timestamp, u.uid, u.name, newmsg, type FROM {privatemsg} p INNER JOIN {users} u ON ";
...
}
( INNER JOIN {users} there ).
But if some users were deleted already, there are some unread messages from deleted users and these messages aren't shown at folders.
Can you fix this please?
Comments
Comment #1
vito_a commentedAttached a patch here.
I've checked it locally, it just does "INNER JOIN {users} u ON p.author = u.uid" so it's just messages from deleted users woudn't be counted at Inbox (these aren't shown in the module already).
Can someone be so kind to test it against 5.x-3.0 please?
Comment #2
vito_a commentedSeems that the previous one was a bit wrong.
Can you please test this against 3.0 not the above one.
It just seems I can't just delete and reattach my previous one attached to the comment. Can someone with corresponding permissions do that?
Comment #3
naheemsays commentedif I remember correctly, 5.x-3.x would also count new messages that were deleted before being read in its unread count... is that still the case?
EDIT - looking at the patch, that has been fixed previously, or I was misremembering.
Comment #4
berdirI'm closing old issues since Privatemsg for Drupal 5 is not maintained anymore. I suggest you switch to Drupal 6 if possible, many of the reported issues are probably already resolved there and if not, you're welcome to open a new issue.
Comment #5
Gabriel R. commentedThis is an issue with Drupal 6 as well. Using 1.5 here and seeing a counter with 2 unread messages while the Inbox is empty.
Comment #6
ptmkenny commentedIf you're still experiencing this problem, please provide steps on how to reproduce the error from a new install of Drupal 6 with Privatemsg 1.5.
Comment #7
ptmkenny commentedComment #8
druvision commentedThis issue also exists in Drupal 7.x versions. The count of unread messages displayed on menu (and page title) on my dev site is bigger then the actual number of unread messages.
Comment #9
ptmkenny commented@Druvision Ok, thanks for confirming this still exists. As per comment #6, could you please provide detailed steps on how to reproduce this error?
Comment #10
oneblankspace commentedComment #11
oneblankspace commentedI am getting pages where the message count does not update in the page title, although it displays correctly on other parts of the page.
Comment #12
ptmkenny commented@oneblankspace Could you please provide detailed steps for how to reproduce this error?
Comment #13
oneblankspace commentedLog in when user has 2 new messages.
Click on messages when there are 2 new messages.
Read messages.
Title of page does not update.
The salient screenshot is in comment #10.
Comment #14
SirenMaya commentedIf I have several new messages and archive some of them without marking them as read the message count shows the number for all the unread messages (both from Inbox and archived) which can be really confusing for users.
Comment #15
dgtlmoon commentedDoes the last patch in #2449325: Off by one bug - message reply not displayed in thread solve it?
And what is your variable "privatemsg_view_max_amount" set to? is it the default 30?
Comment #16
dgtlmoon commented@SirenMaya Yes, I can see that behaviour too - Archived messages are counted as INBOX
In privatemsg_sql_unread_count()
try joining to the pm_tags table and adding the isNotNull, this will fix the issue but only because 'Archiving' removes the Inbox tag , does the following replacement help?
any other thoughts on how to fix this?
Comment #17
dgtlmoon commentedCan confirm in 2.x also
Comment #18
ivnish