[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!
Ideas Centre
Locked
Octopus
Registered User
Posts: 18
Joined: Mon Mar 19, 2007 10:28 am

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by Octopus »

Perhaps I found a bug in this fantastic mod. I installed it in my phpbb 3.0.0. with prosilver and everything works fine. Yesterday i generated two new subforums and get this error:

When there is a new post in a subforum it is shown optical from prosilver as a new post but from this mod i can only read "No unread posts". However when i klick on "No unread posts" i get the normal list of the unreaded posts.

Any Idea?

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

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by asinshesq »

Octopus wrote:When there is a new post in a subforum it is shown optical from prosilver as a new post but from this mod i can only read "No unread posts". However when i klick on "No unread posts" i get the normal list of the unreaded posts.
Thanks for the input. Naturally, subforums are treated differently than forums on the index (I didn't catch that because I never use subforums). I have taken a quick look at this (only a few minutes) and I suspect that doing the following may fix it:

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
includes/functions_display.php

#
#-----[ FIND ]------------------------------------------
#
				$subforum_unread = (isset($forum_tracking_info[$subforum_id]) && $subforum_row['orig_forum_last_post_time'] > $forum_tracking_info[$subforum_id]) ? true : false;

#
#-----[ AFTER, ADD ]------------------------------------------
#
			// start mod view or mark unread posts
			if ($subforum_unread)
			{
				// if there are any unread topics, set $exists_unreads flag to 1 so that
				// when check_unreads_flag() is called in the future it can skip the sql query
				// and give the answer that there are unread posts'
				$exists_unreads = 1;
			}
			// end mod view or mark unread posts
Please let me know if that works. If it does, I'll include it in the version I submit for validation. If not, I'll investigate further when I have time this weekend.

Octopus
Registered User
Posts: 18
Joined: Mon Mar 19, 2007 10:28 am

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by Octopus »

asinshesq wrote:Please let me know if that works. If it does, I'll include it in the version I submit for validation. If not, I'll investigate further when I have time this weekend.
Thanks for your fast answer and the fix.
I tried it out and it seems to work perfekt :-)

moifest
Registered User
Posts: 251
Joined: Tue Nov 06, 2007 4:58 pm

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by moifest »

Great Mod.

Is there any way to add a counter next to the 'View Unread Posts' link so when members login they can see how many unread posts there are, and how many new ones are posted as they are browsing the board.

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

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by asinshesq »

moifest wrote:Great Mod.

Is there any way to add a counter next to the 'View Unread Posts' link so when members login they can see how many unread posts there are, and how many new ones are posted as they are browsing the board.
That would involve a re-write of the function check_unread_posts() that appears in functions_view_or_mark_unread_posts.php
The current code is from phpbb3's core code in functions_display(). It is quite efficient and will not weigh down a board. If you change the code to count topics that have unread posts in them, that will begin to weigh down large boards (and may confuse people because the number of topics with unread posts is different from the number of unread posts). And if you change the code to count unread posts (rather than just topics that have unread posts), I suspect that will substantially weigh down boards (perhaps enough to be noticeable on boards that aren't that big). I don't think the overhead is worth it.

But if you want to take a crack at it, feel free ;)

moifest
Registered User
Posts: 251
Joined: Tue Nov 06, 2007 4:58 pm

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by moifest »

Thanks for the reply.

My phpBB2 board counted the unread posts since last login so was looking for something similar. There is a mod to show new post count on forum index but it does not reset after reading.

Thanks anyway.

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

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by asinshesq »

moifest wrote:Thanks for the reply.

My phpBB2 board counted the unread posts since last login so was looking for something similar. There is a mod to show new post count on forum index but it does not reset after reading.

Thanks anyway.
As you correctly point out, new posts are totally different from unread posts. It is easy to count new posts and that would not weigh down the board materially (the database query just looks for posts with a posttime later than the last visit time). But counting unread posts takes a lot longer because the code has to cycle through each topic and figure out how many posts are in that topic with a posttime after the time the topic was last read. It wouldn't be that hard to code, but my gut sense is that it would weigh down the board in a way that most board admins would not want.

User avatar
moston
Registered User
Posts: 11
Joined: Sun Jan 06, 2008 9:52 am

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by moston »

Is there any way to make the search result always redirect to the first unread post ?

User avatar
ChriZathens
Registered User
Posts: 1477
Joined: Tue Apr 18, 2006 9:11 pm
Location: Athens, Greece
Name: Chris

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by ChriZathens »

moston wrote:Is there any way to make the search result always redirect to the first unread post ?
But there is this function available already...
Clicking at view unread will bring a list with all topics which contain unreads.
Then, clicking at the small icon which is before the topic name ( Image ) will get you to the first unread post...
My mods in MODDB:
Add Homepage link in header - Change user activity post limit - Post number in viewtopic
If you need support click on the support tab there and post your question.
Do not PM me - chances of viewing my PMs are way thinner than viewing the support question in the customization DB...

User avatar
moston
Registered User
Posts: 11
Joined: Sun Jan 06, 2008 9:52 am

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by moston »

I know but I want to the Topic Name be the link to the first unread post.

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

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by asinshesq »

moston wrote:I know but I want to the Topic Name be the link to the first unread post.
Do you just mean that each topic name link should be to the first unread post (i.e. That the topic name link should be the same as the little yellow link)? Or do you mean that you want to know how to sort the list that comes up when you click 'view unread posts' differently?

User avatar
moston
Registered User
Posts: 11
Joined: Sun Jan 06, 2008 9:52 am

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by moston »

I mean that each topic name link should be to the first unread post :)

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

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by asinshesq »

moston wrote:I mean that each topic name link should be to the first unread post :)
I haven't tested this, but give this a try and let us know if it does what you want:

Try this:

Code: Select all

FIND
				'U_VIEW_TOPIC'		=> $view_topic_url,

REPLACE WITH
				'U_VIEW_TOPIC'		=> ($search_id == 'unread') ? $view_topic_url . '&view=unread#unread' : $view_topic_url,
Last edited by asinshesq on Sun Jan 06, 2008 11:11 pm, edited 1 time in total.

User avatar
moston
Registered User
Posts: 11
Joined: Sun Jan 06, 2008 9:52 am

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by moston »

It doesn't work :( Nothing happened when I click on link

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

Re: [BETA] View or Mark Unread Posts for PHPBB3

Post by asinshesq »

moston wrote:It doesn't work :( Nothing happened when I click on link
Sorry, I gave you that too fast. Try this (which seems to work fine on mine):

Code: Select all

FIND
				'U_VIEW_TOPIC'		=> $view_topic_url,

REPLACE WITH
				'U_VIEW_TOPIC'		=> ($search_id == 'unread') ? $view_topic_url . '&view=unread#unread' : $view_topic_url,
I corrected my post above as well.

Locked

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