[MODDB] View or Mark Unread Posts for PHPBB3

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Anti-Spam Guide
Locked
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

[MODDB] View or Mark Unread Posts for PHPBB3

Post by asinshesq »

MOD Title: View or mark unread posts for phpbb3

MOD Description: Adds a 'View unread posts' or 'You have no unread posts' link
on the index page (and, for subsilver2, each other page). Also adds
a 'Mark post as unread' link at the bottom of each post and a mark
pm as unread link at the bottom of each private message as well as
a folder in the private messages part of the UCP for unread pms.

MOD Version: 1.0.4

MOD Download: [see the topic for the validated mod here: http://www.phpbb.com/community/viewtopi ... 9&t=788695 ]

This mod adds back to phpbb3 some of the functionality that existed in the keep unread mod for phpbb2. Specifically, this mod:

- gives users a link to view a list of all unread posts,

- toggles the text of that link from 'View unread posts' to 'You have no unread posts' depending on whether there are any unread posts,

- gives users a link in each post that allows the user to mark that post (and all subsequent posts in the same topic) unread,

- gives users an unread pm mailbox where they can see all unread private messages and

- gives users a link in each pm that allows the user to mark that pm unread.

Dealing with the way phpbb3 treats tracking info was quite a bit more challenging than I expected. It was easy to get it to properly list all unreads, but it was considerably more difficult to get it to allow users to mark posts as unread. I suspect that if there are glitches in the mod, they will be in that part of the mod (though as far as I can tell everything seems to be working fine).

The mod works only with tracking info in the database (it is not set up to read tracking info stored in cookies). For this reason, the mod hides its links from any user who is a guest and also hides links at any time that the board is not set to track unread info in the database. I have no plans to adapt this mod to be able to use cookie info, but if anyone else wants to do that they should feel free.

[edit: I just uploaded a new version 1.0.4. In the contrib folder, I have included an upgrade script for going from version 0.0.4 or 1.0.1 to version 1.0.2, an upgrade script for going from version 1.0.2 to 1.0.3 and an upgrade script going from version 1.0.3 to 1.0.4 (the current version).]
Last edited by asinshesq on Sun Feb 24, 2008 5:37 pm, edited 12 times in total.
saaiberke
Registered User
Posts: 1126
Joined: Wed Jul 20, 2005 8:13 am
Location: Gent/Belgium
Contact:

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by saaiberke »

This is what I was looking for. Will try it today :)

Thanks,

Nic
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by asinshesq »

As I said before, I was planning on adding a view or mark unread pm feature to a future version of this mod. However, taking a quick look at the phpbb3 pm interface, it seems like adding a mark pm unread feature because there is already a concept of marking pms 'important'.

So my plan when I get a chance is to add to this mod:

- code that changes the '___ new messages' link so that it instead says '___ unread messages' (with the blank being the number of unread pms rather than the number of new pms); this will be very easy

- code that will add to the drop down in the inbox the options to display 'all unread messages', 'all important messages' or 'all unread or important messages'

- code that will add to url in the pm notification email that goes out the details of the pm msg_id so that when a user receives a pm notification email and clicks the link he gets taken right to the pm rather than to the inbox

Does that make sense to people? And now that I won't be needing to add a mark unread pm feature, I guess I'll just keep this as a separate mod. Make sense?
saaiberke
Registered User
Posts: 1126
Joined: Wed Jul 20, 2005 8:13 am
Location: Gent/Belgium
Contact:

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by saaiberke »

Alan,

It would be great to add these features. Although the PM system in phpBB3 is improved, your additions seems to be very interesting. Looking forward to it.

GRtz,

Nic
saaiberke
Registered User
Posts: 1126
Joined: Wed Jul 20, 2005 8:13 am
Location: Gent/Belgium
Contact:

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by saaiberke »

I just installed this MOD and it works great, thank you!

Grtz,

Nic

EDIT: 1 little problem found I think. I marked 2 topics as unread but the link in the indexpage still shows "You have no unread posts", when I klick on the link I see both unread posts.

Nic
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by asinshesq »

saaiberke wrote:EDIT: 1 little problem found I think. I marked 2 topics as unread but the link in the indexpage still shows "You have no unread posts", when I klick on the link I see both unread posts.
Oops, I made a last minute change in something and didn't test it's impact on the text toggle (which was working fine last night before I submitted this). I'll fix it tonight if I get a chance. Do the other parts seem to work ok so far?
saaiberke
Registered User
Posts: 1126
Joined: Wed Jul 20, 2005 8:13 am
Location: Gent/Belgium
Contact:

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by saaiberke »

The other parts are working splendid. :D

Grtz,

Nic
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by asinshesq »

EDIT: I just upoaded an updated version (0.0.2) that corrects this bug, so if you install version 0.0.2 or above you don't need to make the changes described below
saaiberke wrote:EDIT: 1 little problem found I think. I marked 2 topics as unread but the link in the indexpage still shows "You have no unread posts", when I klick on the link I see both unread posts.
Ok, try this:

Code: Select all

OPEN
includes/functions.php

FIND
		$s_exists_unreads = $s_inc_unread_link = true;

REPLACE WITH
		$s_exists_unreads = check_unread_posts();
		$s_inc_unread_link = true;

FIND
'S_EXISTS_UNREADS'		=> $s_exists_unread,

REPLACE WITH
'S_EXISTS_UNREADS'		=> $s_exists_unreads,

OPEN
functions_display.php

FIND
	foreach ($forum_rows as $row)

BEFORE, ADD
	// start mod view or mark unread post
	// initialize the flag $exists_unread to signal that we are on the index page
	// (if there are any unreads this will be reset to 1 later on)
	global $exists_unreads;
	$exists_unreads = -1;
	// end mod view or mark unread posts
	
FIND
			global $exists_unreads;
			$exists_unreads = true;

REPLACE WITH
			$exists_unreads = 1;

OPEN
includes/functions_view_or_mark_unread_posts.php

FIND
	if ($exists_unreads)
	{
		return true;
	}

REPLACE WITH
	if ($exists_unreads == 1)
	{
		// user is on index and there are unreads
		return true;
	}

	if ($exists_unreads == -1)
	{
		// user is on index but there are no unreads
		return false;
	}
saaiberke
Registered User
Posts: 1126
Joined: Wed Jul 20, 2005 8:13 am
Location: Gent/Belgium
Contact:

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by saaiberke »

It's all ok now, these changes did the trick. Once again thank you!

Nic
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by asinshesq »

saaiberke wrote:The other parts are working splendid. :D

Grtz,

Nic
Great! Let me know how things work once you make the changes. (I uploaded a new version if you want to start from scratch, and that would be helpful anyway since it will ensure I didn't make any stupid mistakes in fixing the real files.

By the way, if you are like me and you prefer using easymod to install, you can do that by cutting your phpbb3 directory, pasting it into the root folder of a phpbb2 board that has easymod on it, changing each COPY or OPEN instruction in the mod so that it refers to the name of the phpBB3 folder just before the path for whatever the COPY or OPEN is telling you to do, and then running easymod. For example, if your phpbb3 folder is called phpBB3, the first few instructions in the mod would read:

Code: Select all

#
#-----[ COPY ]------------------------------------------------
#
copy root/includes/functions_view_or_mark_unread_posts.php to phpBB3/includes/functions_view_or_mark_unread_posts.php

#
#-----[ OPEN ]------------------------------------------
#
phpBB3/common.php

#
#-----[ FIND ]------------------------------------------
#
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#
// start mod view or mark unread posts
require($phpbb_root_path . 'includes/functions_view_or_mark_unread_posts.' . $phpEx);
// end mod view or mark unread posts

#
#-----[ OPEN ]------------------------------------------
#
phpBB3/search.php
When done, just cut your phpbb3 folder and re-paste it where it belongs in the server. A big time saver!
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by asinshesq »

saaiberke wrote:It's all ok now, these changes did the trick.
Great, thanks for letting me know.
saaiberke
Registered User
Posts: 1126
Joined: Wed Jul 20, 2005 8:13 am
Location: Gent/Belgium
Contact:

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by saaiberke »

asinshesq wrote: By the way, if you are like me and you prefer using easymod to install, you can do that by cutting your phpbb3 directory, pasting it into the root folder of a phpbb2 board that has easymod on it, changing each COPY or OPEN instruction in the mod so that it refers to the name of the phpBB3 folder just before the path for whatever the COPY or OPEN is telling you to do, and then running easymod. For example, if your phpbb3 folder is called phpBB3, the first few instructions in the mod would read:

[SNIP]

When done, just cut your phpbb3 folder and re-paste it where it belongs in the server. A big time saver!
I will try that, it would be a big time saver indeed. Thanks for letting me know this. :)

Grtz,

Nic
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by asinshesq »

saaiberke wrote:
asinshesq wrote: By the way, if you are like me and you prefer using easymod to install, you can do that by cutting your phpbb3 directory, pasting it into the root folder of a phpbb2 board that has easymod on it, changing each COPY or OPEN instruction in the mod so that it refers to the name of the phpBB3 folder just before the path for whatever the COPY or OPEN is telling you to do, and then running easymod. For example, if your phpbb3 folder is called phpBB3, the first few instructions in the mod would read:

[SNIP]

When done, just cut your phpbb3 folder and re-paste it where it belongs in the server. A big time saver!
I will try that, it would be a big time saver indeed. Thanks for letting me know this. :)

Grtz,

Nic
And of course if you use that method you should execute the sql queries manually (via phpmyadmin or whatever) rather than allowing easymod to do them, since easymod will otherwise try to execute the queries on your phpbb2 database ;)
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by asinshesq »

I just found a small glitch in the way this makes posts look in subsilver2. I intended for the 'mark post as unread' link in subsilver2 to appear at the bottom left of the post (same line as the delete, post details and report this post icons appear). But I see that if the post is, for example, only one line long (way shorter than the avatar and other profile info that appears on the left), the mark post as unread link (and those other links) appear just after the text of the post rather than at the very bottom of the post. And I also see that in some cases the sig gets dropped after the post text. I must have messed up the hmtl change in subsilver2's viewtopic_body.html (but it looks fine in prosilver).

I'm terrible at html...if anyone can help correct my error I'd appreciate it. If not, I'll play around with it later this week and I'm sure I'll be able to fix that.

In the meantime, I'm curious as to whether anyone is using this mod on a live board. I really want to see what happens under real rather than test conditions, because the unread logic for marking an already read post as unread is complicated enough that it is possible there will be situations I haven't thought of where the code doesn't work properly after you mark a post as unread (e.g. maybe some posts will show up as unread when they are not or vice versa).
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: ALPHA View or Mark Unread Posts for PHPBB3

Post by asinshesq »

asinshesq wrote:I just found a small glitch in the way this makes posts look in subsilver2. I intended for the 'mark post as unread' link in subsilver2 to appear at the bottom left of the post (same line as the delete, post details and report this post icons appear). But I see that if the post is, for example, only one line long (way shorter than the avatar and other profile info that appears on the left), the mark post as unread link (and those other links) appear just after the text of the post rather than at the very bottom of the post. And I also see that in some cases the sig gets dropped after the post text. I must have messed up the hmtl change in subsilver2's viewtopic_body.html (but it looks fine in prosilver).

I'm terrible at html...if anyone can help correct my error I'd appreciate it. If not, I'll play around with it later this week and I'm sure I'll be able to fix that...
I spoke too soon...I don't think there's anything wrong with what I did to subsilver. What I am finding is that on a clean unmodded phpbb3 RC1 board, if I use subsilver and I post a short post (say one or two lines) and do not click to attach a signature to the post, the resulting post has the bottom right icons substantially higher than the bottom of the post box. In fact, it looks terrible. Is that really the way it is supposed to look, or is that a bug?
Locked

Return to “[3.0.x] MODs in Development”