keep unread flags

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

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
72
75%
Very Good
16
17%
Good
4
4%
Fair
0
No votes
Poor
4
4%
 
Total votes: 96

sikita
Registered User
Posts: 47
Joined: Tue Jun 29, 2004 9:40 am

Subforums

Post by sikita »

It should be in this code... can you check it?

Code: Select all

	// show subforums
	for( $j = 0; $j < $total_forums; $j++ )
	{
		$subforum_id = $subforum_data[$j]['forum_id'];

		if ( $is_auth_ary[$subforum_id]['auth_view'] )
		{
			$unread_topics = false;
			if ( $subforum_data[$j]['forum_status'] == FORUM_LOCKED )
			{
				$folder_image = $images['forum_locked']; 
				$folder_alt = $lang['Forum_locked'];
			}
			else
			{
				if ( $userdata['session_logged_in'] )
				{
					if ( !empty($new_topic_data[$subforum_id]) )
					{
						$subforum_last_post_time = 0;

						while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$subforum_id]) )
						{
							if ( empty($tracking_topics[$check_topic_id]) )
							{
								$unread_topics = true;
								$subforum_last_post_time = max($check_post_time, $subforum_last_post_time);
							}
							else
							{
								if ( $tracking_topics[$check_topic_id] < $check_post_time )
								{
									$unread_topics = true;
									$subforum_last_post_time = max($check_post_time, $subforum_last_post_time);
								}
							}
						}
						if ( !empty($tracking_forums[$subforum_id]) )
						{
							if ( $tracking_forums[$subforum_id] > $subforum_last_post_time )
							{
								$unread_topics = false;
							}
						}
						if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
						{
							if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $subforum_last_post_time )
							{
								$unread_topics = false;
							}
						}

					}
				}

				$folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum']; 
				$folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts']; 
			}

			$posts = $subforum_data[$j]['forum_posts'];
			$topics = $subforum_data[$j]['forum_topics'];

			if ( $subforum_data[$j]['forum_last_post_id'] )
			{
				$last_post_time = create_date($board_config['default_dateformat'], $subforum_data[$j]['post_time'], $board_config['board_timezone']);

				$last_post = $last_post_time . '<br />';

				$last_post .= ( $subforum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($subforum_data[$j]['post_username'] != '' ) ? $subforum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $subforum_data[$j]['user_id']) . '">' . $subforum_data[$j]['username'] . '</a> ';
								
				$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $subforum_data[$j]['forum_last_post_id']) . '#' . $subforum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
			}
			else
			{
				$last_post = $lang['No_Posts'];
			}

			if ( count($subforum_moderators[$subforum_id]) > 0 )
			{
				$l_moderators = ( count($subforum_moderators[$subforum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
				$moderator_list = implode(', ', $subforum_moderators[$subforum_id]);
			}
			else
			{
				$l_moderators = '&nbsp;';
				$moderator_list = '';
			}

			$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
			$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

			$template->assign_block_vars('catrow.forumrow',	array(
				'ROW_COLOR' => '#' . $row_color,
				'ROW_CLASS' => $row_class,
				'FORUM_FOLDER_IMG' => $folder_image, 
				'FORUM_NAME' => $subforum_data[$j]['forum_name'],
				'FORUM_DESC' => $subforum_data[$j]['forum_desc'],
				'POSTS' => $subforum_data[$j]['forum_posts'],
				'TOPICS' => $subforum_data[$j]['forum_topics'],
				'LAST_POST' => $last_post,
				'MODERATORS' => $moderator_list,
				'ID' => $subforum_data[$j]['forum_id'],
				'UNREAD' => intval($unread_topics),
				'LAST_POST_TIME' => $last_post_time,

				'L_MODERATOR' => $l_moderators, 
				'L_FORUM_FOLDER_ALT' => $folder_alt, 

				'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$subforum_id"))
			);

		}
	}
}
// End Simple Subforums MOD
sikita
Registered User
Posts: 47
Joined: Tue Jun 29, 2004 9:40 am

Post by sikita »

The diference is that subforum uses cookies and keep unread uses database, please can you look in the code of subforum and find out if it is possible to use database entries of keep unread?

Thanks
User avatar
Wicher
Registered User
Posts: 1806
Joined: Wed May 07, 2003 10:33 pm
Location: Netherlands or Holland, your choice..
Contact:

Post by Wicher »

This problem has nothing to do with database or cookies.
I have it correct working on my own forum, but sadly i dont know anymore excactly how i got that last error out.
I'm thinking about it now for several weeks, but my mind keeps coming up blank.
But for sure it has nothing to do with database or cookies.
It is somewhere in viewtopic.php or viewforum.php.
sikita
Registered User
Posts: 47
Joined: Tue Jun 29, 2004 9:40 am

Post by sikita »

In this code you can see it is checking unread topics by cookies and keep unread uses database... so this is difference which make different behavior of marking subforum read or unread than the topics, so I ask for help to remove it and make it same like in index.php....
User avatar
Wicher
Registered User
Posts: 1806
Joined: Wed May 07, 2003 10:33 pm
Location: Netherlands or Holland, your choice..
Contact:

Post by Wicher »

Here is my peace of that code, its excactly thesame so the problem is not in this peace of code.

Code: Select all

	// show subforums
	for( $j = 0; $j < $total_forums; $j++ )
	{
		$subforum_id = $subforum_data[$j]['forum_id'];

		if ( $is_auth_ary[$subforum_id]['auth_view'] )
		{
			$unread_topics = false;
			if ( $subforum_data[$j]['forum_status'] == FORUM_LOCKED )
			{
				$folder_image = $images['forum_locked']; 
				$folder_alt = $lang['Forum_locked'];
			}
			else
			{
				if ( $userdata['session_logged_in'] )
				{
					if ( !empty($new_topic_data[$subforum_id]) )
					{
						$subforum_last_post_time = 0;

						while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$subforum_id]) )
						{
							if ( empty($tracking_topics[$check_topic_id]) )
							{
								$unread_topics = true;
								$subforum_last_post_time = max($check_post_time, $subforum_last_post_time);
							}
							else
							{
								if ( $tracking_topics[$check_topic_id] < $check_post_time )
								{
									$unread_topics = true;
									$subforum_last_post_time = max($check_post_time, $subforum_last_post_time);
								}
							}
						}
						if ( !empty($tracking_forums[$subforum_id]) )
						{
							if ( $tracking_forums[$subforum_id] > $subforum_last_post_time )
							{
								$unread_topics = false;
							}
						}
						if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
						{
							if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $subforum_last_post_time )
							{
								$unread_topics = false;
							}
						}

					}
				}

				$folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum']; 
				$folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts']; 
			}

			$posts = $subforum_data[$j]['forum_posts'];
			$topics = $subforum_data[$j]['forum_topics'];

			if ( $subforum_data[$j]['forum_last_post_id'] )
			{
				$last_post_time = create_date($board_config['default_dateformat'], $subforum_data[$j]['post_time'], $board_config['board_timezone']);

				$last_post = $last_post_time . '<br />';

				$last_post .= ( $subforum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($subforum_data[$j]['post_username'] != '' ) ? $subforum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $subforum_data[$j]['user_id']) . '">' . $subforum_data[$j]['username'] . '</a> ';
								
				$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $subforum_data[$j]['forum_last_post_id']) . '#' . $subforum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
			}
			else
			{
				$last_post = $lang['No_Posts'];
			}

			if ( count($subforum_moderators[$subforum_id]) > 0 )
			{
				$l_moderators = ( count($subforum_moderators[$subforum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
				$moderator_list = implode(', ', $subforum_moderators[$subforum_id]);
			}
			else
			{
				$l_moderators = '&nbsp;';
				$moderator_list = '';
			}

			$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
			$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

			$template->assign_block_vars('catrow.forumrow',	array(
				'ROW_COLOR' => '#' . $row_color,
				'ROW_CLASS' => $row_class,
				'FORUM_FOLDER_IMG' => $folder_image, 
				'FORUM_NAME' => $subforum_data[$j]['forum_name'],
				'FORUM_DESC' => $subforum_data[$j]['forum_desc'],
				'POSTS' => $subforum_data[$j]['forum_posts'],
				'TOPICS' => $subforum_data[$j]['forum_topics'],
				'LAST_POST' => $last_post,
				'MODERATORS' => $moderator_list,
				'ID' => $subforum_data[$j]['forum_id'],
				'UNREAD' => intval($unread_topics),
				'LAST_POST_TIME' => $last_post_time,

				'L_MODERATOR' => $l_moderators, 
				'L_FORUM_FOLDER_ALT' => $folder_alt, 

				'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$subforum_id"))
			);

		}
	}
}
// End Simple Subforums MOD
sikita
Registered User
Posts: 47
Joined: Tue Jun 29, 2004 9:40 am

Post by sikita »

So your subforums are market read or unread exactly same way like topics in that forums?
User avatar
Wicher
Registered User
Posts: 1806
Joined: Wed May 07, 2003 10:33 pm
Location: Netherlands or Holland, your choice..
Contact:

Post by Wicher »

Yes, no errors on my forum. :D
rs-bhe.com
Registered User
Posts: 320
Joined: Fri Dec 02, 2005 9:35 pm
Contact:

Post by rs-bhe.com »

Hi there it's me again.

No, please don't run. :?

Will this mod be ideal for keeping all the topics in a particular forum unread no matter what? :oops:
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

rs-bhe.com wrote: Will this mod be ideal for keeping all the topics in a particular forum unread no matter what? :oops:


Yep, that is what it does.
sikita
Registered User
Posts: 47
Joined: Tue Jun 29, 2004 9:40 am

Post by sikita »

Wicher wrote: Yes, no errors on my forum. :D


:( Not on my board... try to remember please... :roll:
User avatar
Wicher
Registered User
Posts: 1806
Joined: Wed May 07, 2003 10:33 pm
Location: Netherlands or Holland, your choice..
Contact:

Post by Wicher »

I am waiting for a clear moment in my brain :wink:

A think that crossed my mind is that, the variable that holds the image to display, is not being emptyed.

Because sometimes it displayes all the time the as new marked image, and somtimes it displayed all the time the marked read image.

But i cannot find where that variable should be set to zero so the program can set it properly again.

Maybe it would be a good idea to clear the keep unread tables so all data about it will be up to date.
notmeagain
Registered User
Posts: 56
Joined: Tue Apr 05, 2005 1:10 am

Post by notmeagain »

Im thinking of installing this but this scares me:


Oh, and one more thing: this is a very long mod and you are almost 100% guaranteed to make mistakes if you try to install it by hand. Please save yourself a lot of time (and please save us support time) by installing with easymod!!


, i dont have easymod and i like installing by hand to ensure no conflicts with other mods... :( do i really have to use easy mod :S
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

notmeagain wrote: Im thinking of installing this but this scares me:


Oh, and one more thing: this is a very long mod and you are almost 100% guaranteed to make mistakes if you try to install it by hand. Please save yourself a lot of time (and please save us support time) by installing with easymod!!


, i dont have easymod and i like installing by hand to ensure no conflicts with other mods... :( do i really have to use easy mod :S


I always install everything by hand. Just be careful and make sure you have backups. However, if you've installed it by hand and it does not work, assume you have made a mistake and solve it yourself :D
User avatar
Wicher
Registered User
Posts: 1806
Joined: Wed May 07, 2003 10:33 pm
Location: Netherlands or Holland, your choice..
Contact:

Post by Wicher »

I atlast got it oke now, i thought i had no errors on my forum anymore, but i only tested with one forum and one subforum.
Today i had to create more than one subforum below a forum and to my surprise it did not work oke.
I went looking and finally i got it real good working now.

Here is the mod to the mod, i'll submit it to phpbbhacks as well.
If there are still any errors please let me know.
Removed the code here, newest version is at:
http://www.phpbb.com/phpBB/viewtopic.ph ... 23#2033623
Last edited by Wicher on Wed Mar 08, 2006 4:49 pm, edited 4 times in total.
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Post by Merlin Sythove »

Looks like good work!
Remind me (once it tests out OK) to add a link to this post and a mention in my first post so people can find it again, or maybe Asinshesq would like to add it to the zip file?
Post Reply

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