Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Private Messages Notification
I am currently using Private Messages 1.1 and it functions perfectly but I would like to add some functionality to it and need a bit of a push in the right direction.
I would like users to see some sort of visual identifier saying they have unread PMs when they visit the site - probably just a box at the top, I have yet to decide. What would be the proper way to query the database and return the number of unread PMs for that user?
0
This discussion has been closed.
Comments
I have also found a line that reads
$NoticeCollector->AddNotice($Context->GetDefinition('SelectPrivateMessagesCategory'));
So, this AddNotice function gets my attention - it seems to be an effective way of notifying the user's they have unread Private Messages. But, I'm not well-versed in OOP PHP. How would I call the GetNewMessageCount() function within the PrivateMessages class from ./index.php (I am thinking in the same area where it builds page controls).
a similar notification box is included in the extension that notifies users of new whispers. i forget the name of it now... maybe it's just called notify?
In index.php, line 58 (after the if ($ShowUpdateMessage) block):
$PrivateMessages = $Context->ObjectFactory->NewContextObject($Context, 'PrivateMessages'); if ($PrivateMessages->GetNewMessagesCount() > 0) { $NoticeCollector->AddNotice('You have unread private messages.'); }
Honestly, I wasn't really expecting this to work - it was a shot in the dark. I'm going to take a look over the work that bshultz did and see if I can devise something.