Page 1 of 2

# of new messages = # unread

Posted: Thu Dec 18, 2003 11:39 pm
by joefish
How can I change the number of new messages (PMs) shown to be the same as the number of *unread* messages, when a member logs in?

bump

Posted: Sat Dec 20, 2003 3:09 am
by joefish
/bump

/bump

Posted: Mon Jan 05, 2004 7:06 am
by joefish
/bump

/bump

Posted: Sat Jan 17, 2004 11:56 am
by joefish
/bump

Re: # of new messages = # unread

Posted: Sat Jan 17, 2004 12:42 pm
by morpheus2matrix
joefish wrote: as the number of *unread* messages,



you are tlaking of unread PM message ?

If yes, this is how phpbb works :roll:

Yes

Posted: Sun Jan 18, 2004 4:44 am
by joefish
Yes, thats what I'm talking about.

But if I get a new PM, once if done anything with the popup window, or gone into my inbox without reading the message, it no longer shows up at the top as "You have X new messages", because it was a 'new message'. Can you see the difference as opposed to an 'unread message'?

Thanks.

Posted: Wed Feb 11, 2004 1:53 pm
by dasChaos
I think that is a fair point. I often have unexperienced user they read one PM and then they never check the others in their inbox again.

The number of messages should really only decrease with how many are UNRAD...!

Is there maybe already a mod out there?

Posted: Thu Feb 12, 2004 10:09 pm
by warmweer
I recognise the "complaint".
What I did was use the Flashing GIF mod and adapt it so that it's compatible with different styles and languages, plus (and this might interest some) as long as there are unread PMs the image for the PMs flashes (can't miss it anymore).OK, it still says there are zero unread messages but I couldn't be bothered with that.

In includes/page_header.php
FIND

Code: Select all

//
// Obtain number of new private messages
// if user is logged in
//
AFTER ADD

Code: Select all

$pm_name = "pm";
FIND

Code: Select all

		{
			$s_privmsg_new = 0;
			$icon_pm = $images['pm_new_msg'];
		}
AFTER ADD

Code: Select all

		$pm_name="pm_new";
FIND

Code: Select all

	{
		$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']);
AFTER ADD

Code: Select all

		$pm_name="pm_new";
		$icon_pm = $images['pm_new_msg'];
FIND

Code: Select all

	'PRIVMSG_IMG' => $icon_pm,
AFTER ADD

Code: Select all

	'PM_NAME' => $pm_name,
In templates\{template}\overall_header.tpl
FIND

Code: Select all

<img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />
REPLACE BY

Code: Select all

<img src="{PRIVMSG_IMG}" width="12" height="13" border="0" alt="{PRIVATE_MESSAGE_INFO}" hspace="3" />
For other templates the images have a different name and extra functions (js) have to be taken into account e.g. Aeolus where the extra variable comes into play and

Code: Select all

				ShowImage("{PRIVATE_MESSAGE_INFO}", "{U_PRIVATEMSGS}", "pm");
becomes

Code: Select all

				ShowImage("{PRIVATE_MESSAGE_INFO}", "{U_PRIVATEMSGS}", "{PM_NAME}");
In templates\{template}\{template}.cfg
ADD

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";
(notice that icon_mini_message.gif is the flashing one) - for templates where the image contains text you'ld have to add the {Lang} variable in the path like this $images['pm_new_msg'] = "$current_template_images/{LANG}/btn_pm_new.gif";

Edit: forgot to mention that this works for me (phpbb 2.0.6 heavily modded, 2 styles, 2 languages) but I can't guarantee it will work for everybody nor do I swear to typing flawlessly. Use at your own risk!

Posted: Sun Apr 04, 2004 12:45 am
by asinshesq
This is pretty easy to mod. If you want to change the header on every page in the forum so that it tells the user how many pms are either 'new' OR 'unread' and refers to them all as 'unread' (which is in my view more logical), all you need to do is the following:

Code: Select all

OPEN
templates/overall_header.tpl

FIND IN-LINE
{PRIVATE_MESSAGE_INFO}

REPLACE IN-LINE WITH
{PRIVATE_MESSAGE_INFO_UNREAD}
(note that this appears twice in that line so you need to replace it twice)

FIND
	$l_privmsgs_text_unread = '';

REPLACE WITH
	$l_privmsgs_text_unread = $lang['Login_check_pm'];


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']);
	}
	else
	{
		$l_privmsgs_text_unread = $lang['No_unread_pm'];
	}

REPLACE WITH
	if ( $userdata['user_unread_privmsg'] + $userdata['user_new_privmsg'] > 0 )
	{
		$l_message_unread = ( $userdata['user_unread_privmsg'] + $userdata['user_new_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
		$l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg'] + $userdata['user_new_privmsg']);
	}
	else
	{
		$l_privmsgs_text_unread = $lang['No_unread_pm'];
	}


And as long as you're at it, you can fool around and make the text telling the user "You have ___ unread messages" much larger, a different color, bold and underlined so that when there are new messages it's really obvious (this is quite useful given that many people use pop-up blockers so the pop up message telling a user he has new or unread messages may be of less utility than it used to be).

Here's how you do that:

Code: Select all

OPEN
templates/overall_header.tpl

FIND IN-LINE
{PRIVATE_MESSAGE_INFO_UNREAD}

skip a line just before before {PRIVATE_MESSAGE_INFO_UNREAD} (for legibility) and then

REPLACE WITH
	<!-- BEGIN switch_unread_pm -->
						<span class="gen"><font color=ff0000><font size=4><u><b>
						<!-- END switch_unread_pm -->
						{PRIVATE_MESSAGE_INFO_UNREAD}
						<!-- BEGIN switch_unread_pm -->
						</b></u>
						<!-- END switch_unread_pm -->


OPEN
includes/page_header.php

FIND 

	if ( !empty($userdata['user_popup_pm']) )
	{
		$template->assign_block_vars('switch_enable_pm_popup', array());
	}


AFTER, ADD
	if ( $userdata['user_unread_privmsg'] + $userdata['user_new_privmsg'] > 0 )
	{
		$template->assign_block_vars('switch_unread_pm', array());
	}


And finally, if you put in the flashing gif mod to signal new pms, you should change that to signal new or unread pms. So,

Code: Select all

OPEN
includes/page_header.php

FIND
	if ( $userdata['user_unread_privmsg'] + $userdata['user_new_privmsg'] > 0 )
	{
		$l_message_unread = ( $userdata['user_unread_privmsg'] + $userdata['user_new_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
		$l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg'] + $userdata['user_new_privmsg']);
	}
	else
	{
		$l_privmsgs_text_unread = $lang['No_unread_pm'];
	}

(these are lines you tinkered with above)

REPLACE WITH
	if ( $userdata['user_unread_privmsg'] + $userdata['user_new_privmsg'] > 0 )
	{
		$l_message_unread = ( $userdata['user_unread_privmsg'] + $userdata['user_new_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
		$l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg'] + $userdata['user_new_privmsg']);
		$icon_pm = $images['pm_new_msg'];
	}
	else
	{
		$l_privmsgs_text_unread = $lang['No_unread_pm'];
		$icon_pm = $images['pm_no_new_msg'];
	}
[Note - I edited this post on July 6 to add a change I had forgotten about in the first part (see next page of this thread for details]

Posted: Wed Apr 07, 2004 9:01 pm
by warmweer
asinshesq wrote: This is pretty easy to mod. All you need to do is: ....


Nice, simple and very well described. I'll be sure to adapt my files this week (but I'll keep the flashing image for all unread PMs).

Come to think of it, it's actually simple to include an extra image for new PMs so as to have the "normal" image, a flashing one when a new PM arrives and another flashing one as long as unread messages remain.

Posted: Wed Apr 07, 2004 9:16 pm
by asinshesq
[deleted]

Posted: Wed Apr 07, 2004 9:20 pm
by asinshesq
warmweer wrote: ...Come to think of it, it's actually simple to include an extra image for new PMs so as to have the "normal" image, a flashing one when a new PM arrives and another flashing one as long as unread messages remain.


That's true...I considered doing just that but decided that for my purposes (with my members who are very very un-computer literate) it would just confuse people to distinguish in any manner between a 'new' message and an 'unread' message.

Please let me know if the mod I described works for you (it works fine on my board, which was 2.0.6 and is now 2.0.8 ).

Posted: Thu Apr 08, 2004 9:05 pm
by warmweer
OK, done with an extra image and it works fine. (on a 2.0.8a board)
But, I have to admit, my idea of including the extra image isn't worth the bother (just more work and what for - the text is more than sufficient -so I'm already back to just 2 images).

One slight remark: size = 4 for the letters is slightly overkill for me (I use size = 2).

Shouldn't someone (no, not me) write this as a mod (extension of the Flashing Gif mod)? I'm sure it will be used by many.

Posted: Thu Apr 08, 2004 10:41 pm
by asinshesq
warmweer wrote: ...One slight remark: size = 4 for the letters is slightly overkill for me (I use size = 2)....


I agree that it's big, but I was trying to make sure it would be REALLY conspicuous because a number of our users weren't realizing they were receiving pm. But of course set it to whatever size you like.
warmweer wrote: ...Shouldn't someone (no, not me) write this as a mod (extension of the Flashing Gif mod)? I'm sure it will be used by many.


Probably makes sense, but it won't be me either.

It seems odd to me that the basic unmodded board is set up to distinguish between new pms and unread pms and that the standard template would choose to show new pms...I would have thought what we've done in this thread (set things up to show if you have any new OR unread pms) would be the preferred approach in a default board.

Posted: Fri Apr 09, 2004 9:56 am
by warmweer
asinshesq wrote: It seems odd to me that the basic unmodded board is set up to distinguish between new pms and unread pms and that the standard template would choose to show new pms...I would have thought what we've done in this thread (set things up to show if you have any new OR unread pms) would be the preferred approach in a default board.

Well, probably nobody ever thought about it (the number of things I never thought about? :o ) or it just wasn't necessary with the popup being sufficient (at the time) and general acceptance that PMs would be read immediately anyway.

Whatever, this is why I like phpbb so much - it's got great functionality and there's still room for extras (5 for me, 6 for you, 3 for somebody else) so that we all have different boards to our liking.

Another thing I like so much is this board where ideas are expanded upon and developed into something useful.

And now I'm going to check the feature requests for 2.2 and submit a request for this (if it hasn't been done before)

Edit : done