View or mark unread posts

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Locked
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: View or mark unread posts

Post by asinshesq »

[deleted]
Last edited by asinshesq on Sat Nov 15, 2008 2:50 pm, edited 1 time in total.

User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: View or mark unread posts

Post by MartectX »

As nobody gave a definite thumbs up for 3.0.3 and "vomup" let me be the first: Updated yesterday, had some conflicts, resolved them manually, everything working fine thus far. Even the unread posts indicator.

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

Re: View or mark unread posts

Post by asinshesq »

[edit: just tried this via update (using the third method below) and it seemed to work fine...please report any problems]

Ok, I haven't tested this but just looking at the conflicts the updater reports it appears that things should work fine if you do the following things (make sure you follow only the instruction below that applies to your situation):

1. For people who are installing this mod for the first time on a phpbb3.0.3 board, I think there is only one change that needs to be modified. You need to change the mod so that the last change to includes/functions_display.php reads like this (and make the change Taz identified as specified at the end of this post):

Code: Select all

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

#
#-----[ FIND ]------------------------------------------
#
				if ($subforum_row['display'] && $subforum_row['name'])

#
#-----[ BEFORE, 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
2. If you already have the mod installed in phpbb3.0.2 and you use the automatic updater and accept its defaults, the defaults will use the new versions of viewtopic.php and functions_display.php without the changes this mod calls for. In that case, when you are all done, you will need to apply this mod's changes (as modified in 1 above) to those files. Here are those changes (and in addition make the change Taz identified as specified at the end of this post):

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
#
$hilit_words	= request_var('hilit', '', true);

#
#-----[ AFTER, ADD ]------------------------------------------
#
// start mod view or mark unread posts
$unread_post_id	= request_var('mu', 0);
if ($unread_post_id)
{
	mark_unread_post($unread_post_id);
}
// end mod view or mark unread posts

#
#-----[ FIND ]------------------------------------------
# Note: actual line is longer
		'U_DELETE'

#
#-----[ AFTER, ADD ]------------------------------------------
#
		// start mod view or mark unread posts
		'U_MARK_UNREAD'		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "mu={$row['post_id']}"),
		// end mod  view or mark unread posts

#
#-----[ OPEN ]------------------------------------------
#
includes/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 have already checked unreads in functions_display()
	// so that when check_unread_posts() is called in the future it can skip the sql query and give the
	// answer that there are none (this gets reset to '1' later on in functions_display() if there are unreads)
	global $exists_unreads;
	$exists_unreads = -1;
	// end mod view or mark unread posts

#
#-----[ FIND ]------------------------------------------
# Note: actual line is longer
		$forum_unread = (isset

#
#-----[ AFTER, ADD ]------------------------------------------
#
		// start mod view or mark unread posts
		if ($forum_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

#
#-----[ FIND ]------------------------------------------
#
				if ($subforum_row['display'] && $subforum_row['name'])

#
#-----[ BEFORE, 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
3. If you already have the mod installed in phpbb3.0.2 and you use the automatic updater but choose to merge files for viewtopic.php and functions_display.php and use the new files for conflicting blocks, you will need to apply this mod's changes (as modified in 1 above) to those conflicting blocks. Here are those changes (and in addition make the change Taz identified as specified at the end of this post):

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
# Note: actual line is longer
		'U_DELETE'

#
#-----[ AFTER, ADD ]------------------------------------------
#
		// start mod view or mark unread posts
		'U_MARK_UNREAD'		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "mu={$row['post_id']}"),
		// end mod  view or mark unread posts

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

#
#-----[ FIND ]------------------------------------------
#
				if ($subforum_row['display'] && $subforum_row['name'])

#
#-----[ BEFORE, 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
4. If you already have the mod installed in phpbb3.0.2 and you use the automatic updater but choose to merge files for viewtopic.php and functions_display.php and use the old files for conflicting blocks, you will need to make the following additional changes to bring those files up to date (and in addition make the change Taz identified as specified at the end of this post):

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
#
		'U_DELETE'			=> (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''),

#
#-----[ REPLACE WITH ]------------------------------------------
#
		'U_DELETE'			=> (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''),

#
#-----[ 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 ]------------------------------------------
#
				if (!$subforum_unread && !empty($subforum_row['children']))
				{
					foreach ($subforum_row['children'] as $child_id)
					{
						if (isset($forum_tracking_info[$child_id]) && $subforums[$forum_id][$child_id]['orig_forum_last_post_time'] > $forum_tracking_info[$child_id])
						{
							// Once we found an unread child forum, we can drop out of this loop
							$subforum_unread = true;
							break;
						}
					}
				}
Regardless of the solution you use as set forth above (solution 1, 2, 3 or 4), you should pick up the change to includes/functions_view_or_mark_unread_posts.php that Tazmanian posted here: http://www.phpbb.com/community/viewtopi ... 5#p7824265

Once someone tries this, please let me know if it works. Thanks.
Last edited by asinshesq on Sun Nov 30, 2008 7:30 pm, edited 4 times in total.

Tazmanian
Registered User
Posts: 218
Joined: Wed Jan 25, 2006 7:02 pm
Location: Belgium
Contact:

Re: View or mark unread posts

Post by Tazmanian »

This mod works on my 3.0.3 board.

Updated from version 3.0.2. But I always use the change files only package and then I re-add the mod changes in those files.

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

Re: View or mark unread posts

Post by asinshesq »

Tazmanian wrote:Updated from version 3.0.2. But I always use the change files only package and then I re-add the mod changes in those files.
Glad to hear it seems to work. But if you re-added the old version of the mod to the changed files (i.e. if you didn't make the change I describe in #1 of the post I posted just before your post), you should make the following additional change to adapt to the revision you need for 3.0.3:

Code: Select all

FIND
				// 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

MOVE DOWN TO JUST BEFORE
				if ($subforum_row['display'] && $subforum_row['name'])
[/code]

User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: View or mark unread posts

Post by MartectX »

You can also put the code into this if-clause (it's a few lines after your proposal):

Code: Select all

				// If one subforum is unread the forum gets unread too...
				if ($subforum_unread)
				{
					$forum_unread = true;
					$exists_unreads = 1;
				}

Tazmanian
Registered User
Posts: 218
Joined: Wed Jan 25, 2006 7:02 pm
Location: Belgium
Contact:

Re: View or mark unread posts

Post by Tazmanian »

Hello asinshesq,

I looked over your post. Changed it to my file. Thanks!

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

Re: View or mark unread posts

Post by asinshesq »

MartectX wrote:You can also put the code into this if-clause (it's a few lines after your proposal):

Code: Select all

				// If one subforum is unread the forum gets unread too...
				if ($subforum_unread)
				{
					$forum_unread = true;
					$exists_unreads = 1;
				}
Yes, that would have been a more sensible way for me to have coded this to begin with (saves an extra if). When the mod to modx converter is finalized so that I can easily to another version, I'll pick that change up too (if I remember it ;) ).

levak
Registered User
Posts: 15
Joined: Tue Nov 04, 2008 2:00 am

Re: View or mark unread posts

Post by levak »

If you use Simple SEO mod:
3. When the user clicks the view unread posts link, the resulting list
of unread posts has...(from the mod install file)
OPEN
search.php

FIND

Code: Select all

'U_VIEW_TOPIC' => $view_topic_url,
REPLACE WITH

Code: Select all

'U_VIEW_TOPIC' => ($search_id == 'unread') ? $view_topic_url . '&view=unread#unread' : $view_topic_url,
The replace line doesn't work (you get: http://www.site.com/topic1001.html&view ... nread).The replace line should be:
REPLACE WITH:

Code: Select all

				'U_VIEW_TOPIC'      => ($search_id == 'unread') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$u_forum_id&t=$result_topic_id&amp" . '&view=unread') . '#unread' : $view_topic_url,
Just in case, anyone with such mod is also applying this mod.
lp, Matej

levak
Registered User
Posts: 15
Joined: Tue Nov 04, 2008 2:00 am

Re: View or mark unread posts

Post by levak »

Hello!

How to add View unread topics on every page or at least viewforum.php?

lp, Matej

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

Re: View or mark unread posts

Post by asinshesq »

levak wrote:How to add View unread topics on every page or at least viewforum.php?
Been covered several times in this topic. The last time was in the string of about 5 posts that starts here: http://www.phpbb.com/community/viewtopi ... 5#p7362695
and spills over onto the next page.

levak
Registered User
Posts: 15
Joined: Tue Nov 04, 2008 2:00 am

Re: View or mark unread posts

Post by levak »

Thank you. How stupid of me not to search the topic.

LeVaK

Tazmanian
Registered User
Posts: 218
Joined: Wed Jan 25, 2006 7:02 pm
Location: Belgium
Contact:

Re: View or mark unread posts

Post by Tazmanian »

I just found it that something is not working.
It works on my 3.0.2 forum (still have a backup working on 3.0.2)

When I go to 'View unread messages' there is a link you can click on 'Mark all forums as read' but if I click on that the unread messages don't disappear.

I think there is a changes in the code since 3.0.3 for mark the forums as read.
I see there is a difference in the standard link on the forum index for marking forums as unread:
in 3.0.2 -> /forum/index.php?mark=forums
in 3.0.3 -> /forum/index.php?hash=af835669&mark=forums

asinshesq, can you take a look and update that for 3.0.3?

EDIT:
I think this have to be changed in /includes/functions_view_or_mark_unread_posts.php

FIND:

Code: Select all

'U_MARK_FORUMS'				=> append_sid("{$phpbb_root_path}index.$phpEx", 'mark=forums'),
REPLACE WITH:

Code: Select all

'U_MARK_FORUMS'				=> append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums'),
Asinshesq, can you confirm that this is correct?

updown
Registered User
Posts: 542
Joined: Sat Jan 05, 2008 6:53 am

Re: View or mark unread posts

Post by updown »

Tazmanian wrote:in 3.0.2 -> /forum/index.php?mark=forums
in 3.0.3 -> /forum/index.php?hash=af835669&mark=forums
Thanks for the hint, I also haven't noticed this yet :shock:

asinshesq, Tazmanian is right, isn't he?

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

Re: View or mark unread posts

Post by asinshesq »

updown wrote:asinshesq, Tazmanian is right, isn't he?
Looks that way to me. Anyone know why they changed that in the 3.0.3 update?

Thanks for tracking that down, taz!

Locked

Return to “[3.0.x] MOD Database Releases”