News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Check if there's new personal messages?

Started by MarkoKg, October 31, 2017, 05:16:02 PM

Previous topic - Next topic

MarkoKg

Hey all,

I'd like to show something like this on my forum index, under the "Show new replies to your posts." link, and remove the "My messages" button from the menu:
"You have no new messages"  - if there's no new messages, or
"you have [1] new message!" - if there's new message.

How can I check if there's new messages though?

Arantor

Check the content of $context['user']['unread_messages']. It should contain the count of PMs.

Though I'd note that making it harder for people to send messages won't encourage use of the feature.

Sir Osis of Liver

IIRC, Bloc's Enterprise theme has something like that.  Take a look at the header code in index.template.php.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Fairly sure even 1.1's Core theme did that, actually.

It's a simple enough if statement based on $context['user']['unread_messages']...

MarkoKg

Thanks, $context['user']['unread_messages'] helped! That's exactly what I was looking for, thanks!

Advertisement: