I'm searching for a way to turn the menu item bold and append the "(x)" to it ("x" being the number of new messages/replies you have) when the user receives a new reply, in the exact same way it does when you receive a fresh new message.
By now it works perfectly for new messages, but if a user sends a reply, the recipient will not be notified at all and may miss the reply - it's actually happening all the time in my site(www.nerdinside.net).
I've been searching for it for a long time and I saw no mentioning of that in any other Queue/forum. I wonder if it actually should behave like that and I have some kind of problem in my installation.
If that solution is not possible, I would like to disable replies all together and allow only new messages. I also could not find a way to do that.
Thanks in advance,
DR
Comments
Comment #1
berdirAre you sure about that?
Each thread that contains unread messages should be marked as unread and also displayed in the menu and in the block. I just tested it on my local test install and it works as expected. I am running the latest 1.x-dev version, but we haven't changed anything regarding that I think.
If you want to display the number of unread messages (replies), you can change the query with the following hook:
http://blog.worldempire.ch/de/api/function/hook_privatemsg_sql_unread_co...
The query is defined in:
http://blog.worldempire.ch/de/api/function/privatemsg_sql_unread_count/1
Displaying unread replies instead should be as easy as replacing the select array with a version that does not DISTINCT. However, I haven't tested it and the number might be too high under some circumstances.
Comment #2
davidribeiro commentedI apologize. What I said is incorrect. The facts:
I was using the default menu item "Messages" and it was working fine. After I renamed it to "Mensagens Pessoais" (portuguese) it stopped working, both for replies and new messages. I didn't notice because I didn't get any new messages after that change but plenty of replies, so I assumed there was a problem on the replies. There is not.
But now I don't know what I did to break it. I assume the code is searching for the item "Messages" and when it doesn't find it, it doesn't update the menu. Am I close?
Is there a way to change that string on the php files?
Thanks and sorry for my precipitate conclusion,
DR
Comment #3
davidribeiro commentedKnowing what the real problem was I was able to find a solution.
1) In function privatemsg_title_callback (privatemsg.module) just replace
return $title;
with
return t('Messages!count', array('!count' => $new));
2) Then use Drupal's Interface Translation to translate
Messages!count
to
whateverYouWant!count
Thanks,
DR
Comment #4
davidribeiro commentedComment #5
berdirExactly, that's how you have to do it.
For the reference, if someone wants to change that string to something else, but in English, a possibility is to use the stringoverrides modules: http://drupal.org/project/stringoverrides
Comment #6
JirkaRybka commentedI guess the change in #3 part 1) is not entirely desirable - I just tested, and the string is perfectly translatable (including quite complex plurals in Czech) - I'm running -dev version of privatemsg on my test site, and I see absolutely no problem with existing privatemsg code regarding this title.
Comment #7
berdirOh, I was misreading..
Yes, that thing is fixed properly in -dev, see http://blog.worldempire.ch/de/api/function/privatemsg_title_callback/1