DennyW 0 Newbie Poster

I do not know the proper way to reword this to work in my version3.0.4. Any help would be much appreciated.

This is what I have there now, 3.0.4, subsilver2:

S_USER_LOGGED_IN -->
<!-- IF S_DISPLAY_PM --> &nbsp;<a href="{U_PRIVATEMSGS}"><img src="{T_THEME_PATH}/images/icon_mini_message.gif" width="12" height="13" alt="*" /> {PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD -->, {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF --></a><!-- ENDIF -->

This is the only info I found, and was told it would not work with the 3.0.4 version. I believe the one below is for version 2.0.

If you want to use images instead of the standard text link showing the private message info in your forum header you will have to create two gif images. Name them pm_no_new_msg.gif and pm_new_msg.gif. Upload those to ./templates/your_template_name/images.

Next you will have to make the following edits:

    #------[ OPEN ]----------------------------
    #
    ./templates/your_template_name/overall_header.tpl
    #
    #------[ FIND ]----------------------------
    #
    <a href="{U_PRIVATEMSGS}" class="mainmenu"><img src="templates/your_template_name/images/icon_mini_message.gif" width="12" height="13" border="0" alt="{PRIVATE_MESSAGE_INFO}" hspace="3" />{PRIVATE_MESSAGE_INFO}</a>
    #
    #------[ REPLACE WITH ]--------------------
    #
    <a href="{U_PRIVATEMSGS}" class="mainmenu"><img src="{PRIVMSG_IMG}" alt="{PRIVATE_MESSAGE_INFO}" hspace="3" />{PRIVATE_MESSAGE_INFO}</a>
    #
    #------[ OPEN ]----------------------------
    #
    ./templates/your_template_name/your_template_name.cfg
    #
    #------[ FIND ]----------------------------
    #
    $images['pm_new_msg'] = "";
    $images['pm_no_new_msg'] = "";
    #
    #------[ REPLACE WITH ]--------------------
    #
    $images['pm_new_msg'] = "$current_template_images/pm_new_msg.gif";
    $images['pm_no_new_msg'] = "$current_template_images/pm_no_new_msg.gif";


If you want the new_pm.gif to show until all new PMs have been read instead of until the user enters his Inbox you have to make one additional edit:

    #
    #------[ OPEN ]----------------------------
    #
    includes/page_header.php
    #
    #------[ FIND ]----------------------------
    #
       if ( $userdata['user_unread_privmsg'] )
       {
          $l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
          $l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg']);
       }
    #
    #------[ REPLACE WITH ]----------------------------
    #
       if ( $userdata['user_unread_privmsg'] )
       {
          $l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
          $l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg']);
          $icon_pm = $images['pm_new_msg'];
       }

Dani AI

Generated

This is a simpler, phpBB 3.0.x–friendly way to show image icons for private messages without changing core PHP: add two theme images and switch which one is shown by the template using a class that reflects “unread” status. Make the change in your style (styles/subsilver2) so you do not touch core files and can restore the original later.

Create two icons (eg. pm-no-new.png and pm-new.png) and put them in
styles/subsilver2/theme/images. Then edit the style template that contains the header (the overall header in the style’s template folder) and replace the PM text/inline image portion with a small wrapper that adds a class when there are unread messages. Example template fragment (use your existing template file and search for the PM block):

<!-- IF S_DISPLAY_PM -->
<a href="{U_PRIVATEMSGS}" class="pm-link<!-- IF PRIVATE_MESSAGE_INFO_UNREAD --> pm-unread<!-- ENDIF -->" title="{PRIVATE_MESSAGE_INFO}">
    <span class="pm-icon" aria-hidden="true"></span>
    <span class="visually-hidden">{PRIVATE_MESSAGE_INFO}</span>
</a>
<!-- ENDIF -->

Then add CSS in your style’s stylesheet (styles/subsilver2/theme/stylesheet.css) to show the correct image:

.pm-link .pm-icon {
  display:inline-block;
  width:12px;
  height:13px;
  background: url("{T_THEME_PATH}/images/pm-no-new.png") no-repeat;
  vertical-align:middle;
}
.pm-link.pm-unread .pm-icon {
  background-image: url("{T_THEME_PATH}/images/pm-new.png");
}
.visually-hidden { position:absolute; left:-9999px; }

Notes and troubleshooting:

  • Purge the template cache after editing (ACP -> General -> Purge the cache, or delete cache files except index.htm/.htaccess).
  • Ensure the active style is subsilver2 (or edit whichever style folder you actually use).
  • File permissions: images typically 644.
  • Keep an accessible label (the hidden text) so screen readers still announce PM info.
  • For retina/HiDPI, provide 2x images and scale them via background-size.

This approach avoids editing PHP, works with phpBB 3.0.4 style structure, and is easy to revert or extend. — if that PM block is hard to find, search the style’s template files for S_DISPLAY_PM or PRIVATE_MESSAGE_INFO to locate the exact spot to replace.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.