Sorry I should have told you this before.
In page_header.php I have modified the "check for messages" part of the code to this:
Code: Select all
//
// Obtain number of new private messages
// if user is logged in
//
$privmsg_normal = '/templates/Appalachia/images/custom_buttons/PM_normal.jpg';
$privmsg_normal_hover = '/templates/Appalachia/images/custom_buttons/PM_normal_hover.jpg';
$privmsg_new = '/templates/Appalachia/images/custom_buttons/PM_new.jpg';
$privmsg_new_hover = '/templates/Appalachia/images/custom_buttons/PM_new_hover.jpg';
if ( ($userdata['session_logged_in']) && (empty($gen_simple_header)) )
{
if ( $userdata['user_new_privmsg'] )
{
$l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms'];
$l_privmsgs_text = sprintf($l_message_new, $userdata['user_new_privmsg']);
if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_last_privmsg = " . $userdata['user_lastvisit'] . "
WHERE user_id = " . $userdata['user_id'];
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update private message new/read time for user', '', __LINE__, __FILE__, $sql);
}
$s_privmsg_new = 1;
$icon_pm = $images['pm_new_msg'];
$image_privmsg = $privmsg_new;
$image_privmsg_hover = $privmsg_new_hover;
}
else
{
$s_privmsg_new = 0;
$icon_pm = $images['pm_new_msg'];
$image_privmsg = $privmsg_normal;
$image_privmsg_hover = $privmsg_normal_hover;
}
}
else
{
$l_privmsgs_text = $lang['No_new_pm'];
$s_privmsg_new = 0;
$icon_pm = $images['pm_no_new_msg'];
$image_privmsg = $privmsg_normal;
$image_privmsg_hover = $privmsg_normal_hover;
}
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']);
}
else
{
$l_privmsgs_text_unread = $lang['No_unread_pm'];
}
}
else
{
$icon_pm = $images['pm_no_new_msg'];
$l_privmsgs_text = $lang['Login_check_pm'];
$l_privmsgs_text_unread = '';
$s_privmsg_new = 0;
$image_privmsg = $privmsg_normal;
$image_privmsg_hover = $privmsg_normal_hover;
}
so basically I create $image_privmsg, and it will contain a blank picture if there is no mail and an image of an envelope when there is mail. You can see this as the "PM" button at
http://bottleweb.org/forum.php. I also have a hover button, which is bascially the same thing just pushed in.
Then near the end of the code I added:
Code: Select all
'IMAGE_PRIVMSG' => $image_privmsg,
'IMAGE_PRIVMSG_HOVER' => $image_privmsg_hover,
I call these from the overall_header.tpl file to get the images for the PM button. I've also done this to get log in/ log out buttons for the forum. It works fine from within phpBB.