0
votes

I'm using Drupal 7 to develop a website. I have the PrivateMsg module enabled so users can send private messages to each other. Problem is, they don't know when they've received a message unless they manually check their messages folder. I want a link to display at the top that says something like "you have [count] new message(s)" or something similar.

I haven't done much coding for Drupal, but I'm assuming this is outside of the module configuration. How could I code this (in my page.tpl.php file I'm assuming) to show the user on the home page they have messages?

Thanks!

EDIT: After reading more of the documentation for this module, I believe it's supposed to have something like this built into the nav menu by default when the module is installed... I have my own theme installed and I see nothing like this. Any idea what I need to do to get it to display?

1

1 Answers

0
votes

I resolved this by adding some php to my page.tpl.php file in the spot I wanted the notification:

$privatemsgcount = privatemsg_unread_count($user);
$msgtext = ($privatemsgcount == 1) ? "message" : "messages";
							
if($privatemsgcount > 0)
{
	echo "<a href=\"/user/".$user->uid."/messages\">You have ".privatemsg_unread_count($user). " unread ".$msgtext."</a>";
}