TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 18, 2024, 11:37:10 PM

Login with username, password and session length
Members
  • Total Members: 3,886
  • Latest: Grendor
Stats
  • Total Posts: 195,189
  • Total Topics: 21,220
  • Online today: 112
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 88
  • Total: 88

[SOLVED] Need a Private Message or PM Block

Started by shengton, September 22, 2008, 05:50:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ianedres

Glad to help...  will mark as solved.

G6Cad

I will move this to block code and snippets from the request board

Ianedres

This is untested, but you can try this to show just how many messages a member has in the mouseover tip over the image...

global $context, $settings, $scripturl;

$msgcount = $context['user']['unread_messages'];

if($context['user']['is_logged'] && $msgcount > 0)
{
echo '<a href="',$scripturl,'?action=pm">';
echo '<img src="',$settings['images_url'],'/menu/newpm.gif" title="You have '.$msgcount.' message' . ($message = $msgcount > 1 ? 's' : ''). ' awaiting." /></a>';
}


Basically, assigns the variable $msgcount (just to use a short name) and in the echo line where the title tag is, it should output an 's' if more than one message awaits. Broke it up into two lines just to make it read better...