phpbb3 tpl privmsg

Private Messages Notifications

Submitted by CyberAlien, Mar 2007.
This tutorial is for designers of phpBB 3 styles. Before reading it you should be familiar with phpBB 3 template system and phpBB 3 templates.

In phpBB 3 there are several template variables that can be used to handle private messages in page header:

  • S_NEW_PM. This flag is set when user has a new private message. It is intended to be used for one time notification only, so once user changes page it disappears. Value is ether “1” or “0”.

  • S_USER_NEW_PRIVMSG. This variable shows number of new private messages. Unlike S_NEW_PM it always shows number of new messages, not once.

  • S_USER_UNREAD_PRIVMSG. This variable shows number of unread private messages. Private messages are treated as unread if they are unread, but not new to current session.

  • PRIVATE_MESSAGE_INFO_UNREAD. This is a string that shows “X unread message(s)” (lang variables UNREAD_PM or UNREAD_PMS). It is empty if there are no unread messages.

  • PRIVATE_MESSAGE_INFO: This is a string that shows private messages status. If there are no new messages it shows “0 new messages” (lang variable NO_NEW_PM). If there are new private messages it shows “X new message(s)” (lang variables NEW_PM or NEW_PMS)

  • U_POPUP_PM / UA_POPUP_PM: url of private message notification popup. It is used in javascript that shows new pm notification. Difference between U_ and UA_ versions is &: in U_ its &, in UA_ its &

  • U_PRIVATEMSGS: url to private messages ucp module.

  • U_RETURN_INBOX / UA_RETURN_INBOX: urls to inbox in usercp pm module. Difference between U_ and UA_ versions is & in url: for for U_ its &amp, for UA_ its &

  • S_DISPLAY_PM: set if private messages should be displayed.

  • S_USER_PM_POPUP: set if pm popup should be displayed.

Those template variables are enough to handle all types of notifications and buttons.

Few examples:

Standard pm text

In overall_header.html in subSilver template in phpBB 3 beta there is this code:


  4.       {L_REGISTER}

First line checks if user is a bot, second line checks if user is logged in, then checks if pm urls should be shown.

Code in proSilver template is much simplier:
Now that you know all variables and have seen few examples you should be able to create custom pm notification in your phpBB style.

Share this tutorial

If you want to show this tutorial to someone else please use following code to link to this tutorial:

HTML Link:
Private Messages Notifications” class=”text” onclick=”this.focus();;”/>
Forum BBCode:

Content of this tutorial may not be published anywhere else without author’s permission. Please link to this page instead.