Page 1 of 2

New then Unread PMs after login 1.0.4

PostPosted: Sat Jan 06, 2007 2:53 pm
by lefty
MOD Name: New then Unread PMs after login
Author: lefty74
MOD Description: Normally, phpbb shows the number of new messages. With this Mod once the amount of new messages have been displayed and the user starts browsing in the forum, the display will change to the amount of unread messages in his/her inbox. The display will be in a different colour to the standard until all messages have been read.


MOD Version: 1.0.4 (Updated 15/04/07)
Installation Level: Easy
Installation Time: ~ 5 Minutes
Tested on phpBB Version: 2.0.22

Download File: New then Unread PMs after login

Screenshots:
1. New Messages have arrived
Image

2. Total Messages unread
Image

3. After reading a message, remaining Messages unread
Image

Mod at:
* phpBB.com
* phpBBHacks.com

PostPosted: Sun Jan 14, 2007 4:36 pm
by lefty
Updated to version 1.0.3 and submitted for validation

Code: Select all
##   2007-01-14 - Version 1.0.3
##      - added counter for unread msg to avoid
##         the problem of having a value in the user_unread_privmsg
##         from unread msgs sent by deleted users

PostPosted: Tue Mar 20, 2007 4:16 am
by mitchschaft
Great mod! I have a question. Can you help me merge your mod with the one I currently have.
If you receive a new PM, the message image (icon_mini_no_message.gif) switches to an animated gif (icon_mini_message.gif). After installing your mod, the animated gif after receiving a new PM works, but the standard image is not shown (red x).
I assume it might have to do with your mod's page_header.php modification
Code: Select all
$icon_pm = $images['pm_no_new_msg'];
   $l_privmsgs_text = $lang['Login_check_pm'];
   $s_privmsg_new = 0;


Can you make that image point to the image from the subSilver.cfg file?
Code: Select all
$images['pm_new_msg'] = "$current_template_images/icon_mini_message.gif";
$images['pm_no_new_msg'] = "$current_template_images/icon_mini_no_message.gif";


Here's the entire mod:

Code: Select all
#################################################################
## MOD Title: PM Notification Enhancer
## MOD Author: acoolwelshbloke < acoolwelshbloke@tec2spec.co.uk > (Paul Norman) http://www.tec2spec.co.uk
## MOD Description: The Private Message Popup notification will arrive in the center of your screen
## and the Private Message GIF image will flash when you have new Private Messages waiting.
## MOD Version: 1.0.1
##
## Installation Level: Easy
## Installation Time: 3 minutes
## Files To Edit: 2
##      templates/subSilver/overall_header.tpl
##      templates/subSilver/subSilver.cfg
##
## Included Files: 4
##      root/templates/subSilver/images/icon_mini_message.gif
##      root/templates/subSilver/images/icon_mini_no_message.gif
##
##   goodies/icon_mini_message.gif
##   goodies/icon_mini_no_message.gif
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
## EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
## FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
## THE AUTHOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
## INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
## ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
##
##############################################################
## MOD History:
##
##   2002-03-17 - Version 1.0.1
##         - First release
##               
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################

#
#-----[ OPEN ]------------------------------------------------
#

overall_header.tpl

#
#-----[ FIND ]------------------------------------------------
#

<!-- BEGIN switch_enable_pm_popup -->
<script language="Javascript" type="text/javascript">
<!--
  if ( {PRIVATE_MESSAGE_NEW_FLAG} )
  {
     window.open('{U_PRIVATEMSGS_POPUP}', '_phpbbprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400');;
  }
//-->
</script>
<!-- END switch_enable_pm_popup -->

#
#-----[ REPLACE WITH ]----------------------------------------
#

<!-- BEGIN switch_enable_pm_popup -->
<script language="Javascript" type="text/javascript">
<!--
var win = null;
function phpBBPOPUP(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
  if ( {PRIVATE_MESSAGE_NEW_FLAG} )
  {
     phpBBPOPUP('{U_PRIVATEMSGS_POPUP}', '_phpbbprivmsg', '450', '225', 'no');;
  }
//-->
</script>
<!-- END switch_enable_pm_popup -->

#
#-----[ FIND ]------------------------------------------------
#
templates/subSilver/images/icon_mini_message.gif

#
#-----[ REPLACE WITH ]----------------------------------------
#
{PRIVMSG_IMG}

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/subSilver.cfg

#
#-----[ FIND ]------------------------------------------------
#
$images['pm_new_msg'] = "";
$images['pm_no_new_msg'] = "";

#
#-----[ REPLACE WITH ]----------------------------------------
#

$images['pm_new_msg'] = "$current_template_images/icon_mini_message.gif";
$images['pm_no_new_msg'] = "$current_template_images/icon_mini_no_message.gif";

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM


It has something to do with the overall_header.tpl and the following line:
Code: Select all
<a href="{U_PRIVATEMSGS}" class="mainmenu"><img src="templates/aluminoid/images/icon_mini_no_message.gif" width="98" height="20" border="0" hspace="3" />{PRIVATE_MESSAGE_INFO}</a>


The other mod has you replace "templates/aluminoid/images/icon_mini_no_message.gif" with "{PRIVMSG_IMG}".

Any way. If you're up to it, let me know if you can help.

Thanks,
Mitch
rig-talk.com

PostPosted: Tue Mar 20, 2007 12:22 pm
by lefty
hi mitch,
glad you like the mod.  :happysmerk:

I will have a look but I am afraid I will not be able to do anything until next week since I am going away for a few days as from tomorrow.

PostPosted: Tue Mar 20, 2007 11:37 pm
by mitchschaft
That's cool, I can wait as long as it takes.
This is due to my lack of knowledge with PHP. I'm not sure what points to what and where :lol:.

PostPosted: Wed Mar 28, 2007 8:34 pm
by lefty
hi mitch,
sorry, only got back yesterday.

Please try this:

Code: Select all
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
   else
   {
   if ( $userdata['user_unread_privmsg'] )
   {
      $l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
      $l_privmsgs_text = sprintf($l_message_unread, $userdata['user_unread_privmsg']);
      $s_privmsg_new = 0;
   }
   else
   {
      $l_privmsgs_text = $lang['No_unread_pm'];
      $s_privmsg_new = 0;
   }
   }
   }
else
{
   $icon_pm = $images['pm_no_new_msg'];
   $l_privmsgs_text = $lang['Login_check_pm'];
   $s_privmsg_new = 0;
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
   else
   {
      
   if ( $userdata['user_unread_privmsg'] )
   {
      $l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
      $l_privmsgs_text = sprintf($l_message_unread, $userdata['user_unread_privmsg']);
      $s_privmsg_new = 0;
      $icon_pm = $images['pm_new_msg'];
   }
   else
   {
      $l_privmsgs_text = $lang['No_unread_pm'];
      $s_privmsg_new = 0;
      $icon_pm = $images['pm_no_new_msg'];
   }
   }
}
else
{
   $icon_pm = $images['pm_no_new_msg'];
   $l_privmsgs_text = $lang['Login_check_pm'];
   $s_privmsg_new = 0;
}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

PostPosted: Wed Mar 28, 2007 10:20 pm
by mitchschaft
Awesome, that did the trick! Thanks for your work, man.

PostPosted: Wed Mar 28, 2007 10:50 pm
by lefty
Awesome, that did the trick! Thanks for your work, man.

Cool, glad it worked  :thumbsup:

PostPosted: Wed Mar 28, 2007 11:43 pm
by mitchschaft
Thanks for helping. This helps me understand php code a little better.

I made a slight modification to have the icon flash ONLY when there is a new message. It goes back to the regular, no message icon when it is unread.

I used the 'pm_no_new_msg', image pointer code (whatever you call it) for all 3 instances instead of just the bottom 2.

:goodideasign:

Thanks again, lefty.

PostPosted: Thu Mar 29, 2007 8:59 am
by lefty
mitchschaft wrote:I made a slight modification to have the icon flash ONLY when there is a new message. It goes back to the regular, no message icon when it is unread.

I used the 'pm_no_new_msg', image pointer code (whatever you call it) for all 3 instances instead of just the bottom 2.


Good stuff :thumbsup:, php is easier than it looks sometimes, isnt it?

PostPosted: Sun Apr 15, 2007 5:32 am
by Coroner
Hey Lefty! I'm gonna need some help with this one.

Here's the problem: none of my templates are normal. They are all moded with various bells and whistles so when I get to the overall_header.tpl it's game over!

Here's one example from the fwsblack template:
<!-- BEGIN switch_user_logged_in -->
&nbsp;<a href="{U_STAT_HEADERLINK}" class="mainmenu">{L_STAT_HEADERLINK}</a>&nbsp;
<!-- END switch_user_logged_in -->
</span><span class="mainmenu"> <a href="{U_PROFILE}" class="mainmenu">{L_PROFILE}</a> &nbsp; <a href="{U_CALENDAR}" class="mainmenu">{L_CALENDAR}</a>  <a href="{U_WEATHER}" class="mainmenu">{L_WEATHER}  <a href="{U_PRIVATEMSGS}" class="mainmenu">{PRIVATE_MESSAGE_INFO}</a>   <a href="{U_LOGIN_LOGOUT}" class="mainmenu">{L_LOGIN_LOGOUT}</a> </span>

Here's acidtechblood:
<!-- BEGIN switch_user_logged_in -->
<center><div class="pm-{PRIVMSG_IMG}"><a href="{U_PRIVATEMSGS}">{PRIVATE_MESSAGE_INFO}</a></div></center>
<!-- END switch_user_logged_in -->

So as you can see, I have a problem. It has changed the color of the private messages link but no pop-up window.

Please let me know!
Thanks!

PostPosted: Sun Apr 15, 2007 9:58 am
by lefty
for acidtechblood, please do the following

try the same solution as for mitchschaft, it worked when i had a quick test just now:


Code: Select all
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
   else
   {
   if ( $userdata['user_unread_privmsg'] )
   {
      $l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
      $l_privmsgs_text = sprintf($l_message_unread, $userdata['user_unread_privmsg']);
      $s_privmsg_new = 0;
   }
   else
   {
      $l_privmsgs_text = $lang['No_unread_pm'];
      $s_privmsg_new = 0;
   }
   }
   }
else
{
   $icon_pm = $images['pm_no_new_msg'];
   $l_privmsgs_text = $lang['Login_check_pm'];
   $s_privmsg_new = 0;
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
   else
   {
      
   if ( $userdata['user_unread_privmsg'] )
   {
      $l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
      $l_privmsgs_text = sprintf($l_message_unread, $userdata['user_unread_privmsg']);
      $s_privmsg_new = 0;
      $icon_pm = $images['pm_new_msg'];
   }
   else
   {
      $l_privmsgs_text = $lang['No_unread_pm'];
      $s_privmsg_new = 0;
      $icon_pm = $images['pm_no_new_msg'];
   }
   }
}
else
{
   $icon_pm = $images['pm_no_new_msg'];
   $l_privmsgs_text = $lang['Login_check_pm'];
   $s_privmsg_new = 0;
}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


i tried it with acidblood but since i couldnt find fwsblack without registering i couldnt try it on that. please let me know if that solves your issue also with fwsblack, if not, grateful if you could send me a copy of that style...

thanks

PostPosted: Sun Apr 15, 2007 9:59 am
by lefty
btw, thanks for reporting this guys. i didnt realise that so many templates were using the images for their styles so will update the mod to include above to cater for more styles...

PostPosted: Sun Apr 15, 2007 2:48 pm
by lefty
Code: Select all
[color=yellow]##   2007-04-15 - Version 1.0.4
##      - added $icon_pm image so other templates do not have problems[/color]

PostPosted: Mon Apr 16, 2007 6:25 am
by Coroner
Outstanding! Works like a charm in all the templates. Weird thing is that I found all kinds of damage in codes I have never altered or don't remember altering. subSilver for instance didn't even have the private messages link at the top. I know it was there at one point but somehow it ran off. Got it back though :)

Here the template for you to play with. It's vanilla so what you see it the real deal.

As always, thank you so very much for such cool mods!

PostPosted: Mon Apr 16, 2007 11:24 am
by lefty
Works like a charm in all the templates.

 
 Nice, good it works for all the templates now :)

Here the template for you to play with.

It does work with that one as well though, doesnt it?

As always, thank you so very much for such cool mods!
Thanks for using them, it is good to know that others find them useful too  :happysmerk:

PostPosted: Mon Apr 16, 2007 1:07 pm
by Coroner
It works with this template. I just thought I would show you cause some codes in some file are different then in most templates.

PostPosted: Mon Apr 16, 2007 6:03 pm
by lefty
Coroner wrote:It works with this template. I just thought I would show you cause some codes in some file are different then in most templates.


ah, i see  :happysmerk:  thanks very much  :thumbsup:

Re: New then Unread PMs after login 1.0.4

PostPosted: Mon Jan 28, 2008 1:09 am
by sK*sl!ce
Hey Lefty! I think I will have all your mod's installed on our site after this one! lol :D

One question, we have a template that we purchased and the overall header's got me stumped... Here's what I have (and your's underneath)

Code: Select all
<img src="templates/SMF4/images/pip.gif" alt="" height="9" width="6" border="0"><span class="mainmenu">&nbsp;<a class="nav" href="{U_PROFILE}" class="mainmenu">{L_PROFILE}</a></span>&nbsp;&nbsp;<img src="templates/SMF4/images/pip.gif" alt="" height="9" width="6" border="0"><span class="mainmenu">&nbsp;<a class="nav" href="{U_PRIVATEMSGS}" class="mainmenu">{PRIVATE_MESSAGE_INFO}</a>&nbsp;&nbsp;</span><img src="templates/SMF4/images/pip.gif" alt="" height="9" width="6" border="0"><span class="mainmenu">&nbsp;<a class="nav" href="{U_LOGIN_LOGOUT}" class="mainmenu">{L_LOGIN_LOGOUT}</a></span></td>

<td height="25" align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&nbsp;<a href="{U_PROFILE}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />{L_PROFILE}</a>&nbsp; &nbsp;<a href="{U_PRIVATEMSGS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_message.gif" width="12" height="13" border="0" hspace="3" />{PRIVATE_MESSAGE_INFO}</a>&nbsp; &nbsp;<a href="{U_LOGIN_LOGOUT}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_login.gif" width="12" height="13" border="0" alt="{L_LOGIN_LOGOUT}" hspace="3" />{L_LOGIN_LOGOUT}</a>&nbsp;</span></td>


I also have an audible message for new posts as well, but I think I was able to merge that OK. Is this do-able?

Thanks,
-sl!ce

Re: New then Unread PMs after login 1.0.4

PostPosted: Mon Jan 28, 2008 7:20 pm
by lefty
hi, nice to hear you like my mod :happysmerk:

i will have a look a little bit later today. it has been a little while since i looked at this mod. ;)

Re: New then Unread PMs after login 1.0.4

PostPosted: Mon Jan 28, 2008 8:25 pm
by lefty
hi, this should actually work as is, have you tried it already?

Re: New then Unread PMs after login 1.0.4

PostPosted: Mon Jan 28, 2008 11:52 pm
by sK*sl!ce
edit: yes, it worked after i fixed my privmsg.php file :P THANKS!!! :cheer:

Re: New then Unread PMs after login 1.0.4

PostPosted: Tue Jan 29, 2008 12:56 am
by lefty
excellent :)

Re: New then Unread PMs after login 1.0.4

PostPosted: Sun Dec 07, 2008 5:29 am
by amethyst5
Will you be updating this mod for use with phpbb3?

thanks

Re: New then Unread PMs after login 1.0.4

PostPosted: Sun Dec 07, 2008 10:41 am
by lefty
i never thought about it and i do not know if that has been done already.

yeah, i suppose i could if it has not been done yet. :happysmerk: