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

Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: keep unread flags

Post by Merlin Sythove »

Sounds like the loop is not working as it should, probably a typo in viewforum.php. Check that file with a tooth comb against the mod instructions.
Need custom work done? Pimp My Forum!

Royal Trude
Registered User
Posts: 3
Joined: Thu May 17, 2007 7:15 am

Re: keep unread flags

Post by Royal Trude »

it was all so simple... so simple... got it working! And yes, it was the loop... I thought before posting the question that it might be the loop... but saw no bug there... your reply just opened my eyes. Thanks!

:lol:

Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: keep unread flags

Post by Merlin Sythove »

Briljant, go enjoy!
Need custom work done? Pimp My Forum!

wolflet
Registered User
Posts: 45
Joined: Thu May 31, 2007 7:38 am

Re: keep unread flags

Post by wolflet »

hi. i have installed this mod into my forum and it is working perfectly. but whenever i click on

view unread post
view your post
view unanswered post


i got the error

Parse error: syntax error, unexpected T_ELSE in /home/hfda/public_html/forum/search.php on line 543

can someone help?

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

Re: keep unread flags

Post by asinshesq »

wolflet wrote:hi. i have installed this mod into my forum and it is working perfectly. but whenever i click on

view unread post
view your post
view unanswered post


i got the error

Parse error: syntax error, unexpected T_ELSE in /home/hfda/public_html/forum/search.php on line 543

can someone help?
Sounds like you messed up the changes to search.php (either the changes made by this mod or the changes made by some other mod). Post lines 450 to lines 550 of search.php here and we'll see what we can see.

wolflet
Registered User
Posts: 45
Joined: Thu May 31, 2007 7:38 am

Re: keep unread flags

Post by wolflet »

erm. sorry but how do i get to line 450-550? my cpanel doesnt allow me to go by line number

anyway. i think the problem should lie here

Code: Select all

			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain posts list', '', __LINE__, __FILE__, $sql);
			}

			// Add posts to list of id's
			while( $row = $db->sql_fetchrow($result) )
			{
				//START MOD Keep_unread_2
				$topic_id = $row['topic_id'];
				$forum_id = $row['forum_id'];
				$unread_topic = true;
				//Don't add post if you've read it and you want new posts only
				if ( ($search_id == 'newposts') )
				{
					$unread_topic = ( $row['post_time'] > topic_last_read($forum_id, $topic_id) );
				}
				if ( $unread_topic )	$search_ids[] = $row['post_id'];
				//END MOD Keep_unread_2
			}
			$db->sql_freeresult($result);

			$total_match_count = count($search_ids);
		
			}
			else if ( $search_author != '' || $search_time || $auth_sql != '' )
			{
				$search_id_chunks = array();
				$count = 0;
				$chunk = 0;

				if (count($search_ids) > $limiter)
				{
					for ($i = 0; $i < count($search_ids); $i++) 
					{
						if ($count == $limiter)
						{
							$chunk++;
							$count = 0;
						}
					
						$search_id_chunks[$chunk][$count] = $search_ids[$i];
						$count++;
					}
				}
				else
				{
					$search_id_chunks[0] = $search_ids;
				}

				$search_ids = array();

				for ($i = 0; $i < count($search_id_chunks); $i++)
				{
					$where_sql = ( $search_author == '' && $auth_sql == '' ) ? 'post_id IN (' . implode(', ', $search_id_chunks[$i]) . ')' : 'p.post_id IN (' . implode(', ', $search_id_chunks[$i]) . ')';
					$select_sql = ( $search_author == '' && $auth_sql == '' ) ? 'post_id' : 'p.post_id';
					$from_sql = (  $search_author == '' && $auth_sql == '' ) ? POSTS_TABLE : POSTS_TABLE . ' p';

					if ( $search_time )
					{
						$where_sql .= ( $search_author == '' && $auth_sql == '' ) ? " AND post_time >= $search_time " : " AND p.post_time >= $search_time";
					}

					if ( $auth_sql != '' )
					{
						$from_sql .= ", " . FORUMS_TABLE . " f";
						$where_sql .= " AND f.forum_id = p.forum_id AND $auth_sql";
					}

					if ( $search_author != '' )
					{
						$from_sql .= ", " . USERS_TABLE . " u";
						$where_sql .= " AND u.user_id = p.poster_id AND u.username LIKE '$search_author'";
					}

					$sql = "SELECT " . $select_sql . " 
						FROM $from_sql 
						WHERE $where_sql";
					if ( !($result = $db->sql_query($sql)) )
					{
						message_die(GENERAL_ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
					}

					while( $row = $db->sql_fetchrow($result) )
					{
						$search_ids[] = $row['post_id'];
					}
					$db->sql_freeresult($result);
				}

				$total_match_count = count($search_ids);
			}
		}
		else if ( $search_id == 'unanswered' )
		{
			if ( $auth_sql != '' )
			{
				$sql = "SELECT t.topic_id, f.forum_id
					FROM " . TOPICS_TABLE . "  t, " . FORUMS_TABLE . " f
					WHERE t.topic_replies = 0 
						AND t.forum_id = f.forum_id
						AND t.topic_moved_id = 0
						AND $auth_sql";
			}
			else
			{
				$sql = "SELECT topic_id 
					FROM " . TOPICS_TABLE . "  
					WHERE topic_replies = 0 
						AND topic_moved_id = 0";
			}
				
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
			}

			$search_ids = array();
			while( $row = $db->sql_fetchrow($result) )
			{
				$search_ids[] = $row['topic_id'];
			}
			$db->sql_freeresult($result);

			$total_match_count = count($search_ids);

			//
			// Basic requirements
			//
			$show_results = 'topics';
			$sort_by = 0;
			$sort_dir = 'DESC';
		}
		else
		{
			message_die(GENERAL_MESSAGE, $lang['No_search_match']);
		}
heres code from 450-550

Code: Select all

		if ( $total_match_count )
		{
			if ( $show_results == 'topics' )
			{
				//
				// This one is a beast, try to seperate it a bit (workaround for connection timeouts)
				//
				$search_id_chunks = array();
				$count = 0;
				$chunk = 0;

				if (count($search_ids) > $limiter)
				{
					for ($i = 0; $i < count($search_ids); $i++) 
					{
						if ($count == $limiter)
						{
							$chunk++;
							$count = 0;
						}
					
						$search_id_chunks[$chunk][$count] = $search_ids[$i];
						$count++;
					}
				}
				else
				{
					$search_id_chunks[0] = $search_ids;
				}

				$search_ids = array();

				for ($i = 0; $i < count($search_id_chunks); $i++)
				{
					$where_sql = '';

					if ( $search_time )
					{
						$where_sql .= ( $search_author == '' && $auth_sql == ''  ) ? " AND post_time >= $search_time " : " AND p.post_time >= $search_time ";
					}
	
					if ( $search_author == '' && $auth_sql == '' )
					{
						$sql = "SELECT topic_id 
							FROM " . POSTS_TABLE . "
							WHERE post_id IN (" . implode(", ", $search_id_chunks[$i]) . ") 
							$where_sql 
							GROUP BY topic_id";
					}
					else
					{
						$from_sql = POSTS_TABLE . " p"; 

						if ( $search_author != '' )
						{
							$from_sql .= ", " . USERS_TABLE . " u";
							$where_sql .= " AND u.user_id = p.poster_id AND u.username LIKE '$search_author' ";
						}

						if ( $auth_sql != '' )
						{
							$from_sql .= ", " . FORUMS_TABLE . " f";
							$where_sql .= " AND f.forum_id = p.forum_id AND $auth_sql";
						}

						$sql = "SELECT p.topic_id 
							FROM $from_sql 
							WHERE p.post_id IN (" . implode(", ", $search_id_chunks[$i]) . ") 
								$where_sql 
							GROUP BY p.topic_id";
					}
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain posts list', '', __LINE__, __FILE__, $sql);
			}

			// Add posts to list of id's
			while( $row = $db->sql_fetchrow($result) )
			{
				//START MOD Keep_unread_2
				$topic_id = $row['topic_id'];
				$forum_id = $row['forum_id'];
				$unread_topic = true;
				//Don't add post if you've read it and you want new posts only
				if ( ($search_id == 'newposts') )
				{
					$unread_topic = ( $row['post_time'] > topic_last_read($forum_id, $topic_id) );
				}
				if ( $unread_topic )	$search_ids[] = $row['post_id'];
				//END MOD Keep_unread_2
			}
			$db->sql_freeresult($result);

			$total_match_count = count($search_ids);
		
			}
			else if ( $search_author != '' || $search_time || $auth_sql != '' )
			{
				$search_id_chunks = array();
				$count = 0;
				$chunk = 0;

				if (count($search_ids) > $limiter)
				{
					for ($i = 0; $i < count($search_ids); $i++) 
					{
						if ($count == $limiter)
						{
							$chunk++;
							$count = 0;
						}
					
						$search_id_chunks[$chunk][$count] = $search_ids[$i];
						$count++;
					}
				}
				else
				{
					$search_id_chunks[0] = $search_ids;
				}

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

Re: keep unread flags

Post by asinshesq »

wolflet wrote:erm. sorry but how do i get to line 450-550? my cpanel doesnt allow me to go by line number
By copying the text and pasting it into whatever text editor you are using. Just pm me your full search.php file and I'll take a look when I have a chance (maybe later tonight).

cp7
Registered User
Posts: 3
Joined: Sat Jul 21, 2007 5:23 pm

Re: keep unread flags

Post by cp7 »

I'm trying to install this MOD on my forum. It seems that it requires an earlier MOD and upgrades from there. Can someone please provide a link to that first MOD? There are links in the first few posts, but those won't allow me. Thanks!

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

Re: keep unread flags

Post by asinshesq »

cp7 wrote:I'm trying to install this MOD on my forum. It seems that it requires an earlier MOD and upgrades from there. Can someone please provide a link to that first MOD? There are links in the first few posts, but those won't allow me. Thanks!
No, it doesn't require anything else. The link to version 2.0.6 is in the very first post of this topic and it works fine (I just tried it). And the relevant file in the zip that you need to open up and follow is keep_unread_2-0-6.txt.

Since it seems like you are new at the business of modding, allow me to strongly suggest that you install this with easymod rather than trying to install it manually. It's a pretty long mod and you are likely to make a mistake if you try to do it manually. If you don't already have easymod, go here: http://area51.phpbb.com/phpBB/viewforum.php?f=15

And of course, back up all your phpbb files before you start.

cp7
Registered User
Posts: 3
Joined: Sat Jul 21, 2007 5:23 pm

Re: keep unread flags

Post by cp7 »

No, it doesn't require anything else. The link to version 2.0.6 is in the very first post of this topic and it works fine (I just tried it). And the relevant file in the zip that you need to open up and follow is keep_unread_2-0-6.txt.

Since it seems like you are new at the business of modding, allow me to strongly suggest that you install this with easymod rather than trying to install it manually. It's a pretty long mod and you are likely to make a mistake if you try to do it manually. If you don't already have easymod, go here: http://area51.phpbb.com/phpBB/viewforum.php?f=15

And of course, back up all your phpbb files before you start.
Thank you for the response.
I do have easymod installed. I can see the install options for all the upgrades, but there is no install option for the keep_unread_2-0-6.txt file. The file is definitely uploaded to my FTP, just doesn't show up on the easymod install page.

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

Re: keep unread flags

Post by asinshesq »

cp7 wrote:I do have easymod installed. I can see the install options for all the upgrades, but there is no install option for the keep_unread_2-0-6.txt file. The file is definitely uploaded to my FTP, just doesn't show up on the easymod install page.
What do you mean when you say the file is uploaded? Do you mean the final keep unread folder and the files underneath it?

In order for easymod to see the mod, it needs to be in the right place. Specifically, the folder structure needs to look exactly like this:

[phpbb_root]/admin/keep_unread_version_2-0-6/keep_unread_2-0-6.txt

So for example, if you have two levels of folders like the following it will NOT work:
[phpbb_root]/admin/keep_unread_version_2-0-6/keep_unread_2-0-6.txt

The only other reason easymod sometimes doesn't recognize a mod is if easymod has already installed it (it screens out mods you have already installed).

cp7
Registered User
Posts: 3
Joined: Sat Jul 21, 2007 5:23 pm

Re: keep unread flags

Post by cp7 »

What do you mean when you say the file is uploaded? Do you mean the final keep unread folder and the files underneath it?

In order for easymod to see the mod, it needs to be in the right place. Specifically, the folder structure needs to look exactly like this:

[phpbb_root]/admin/keep_unread_version_2-0-6/keep_unread_2-0-6.txt

So for example, if you have two levels of folders like the following it will NOT work:
[phpbb_root]/admin/keep_unread_version_2-0-6/keep_unread_2-0-6.txt

The only other reason easymod sometimes doesn't recognize a mod is if easymod has already installed it (it screens out mods you have already installed).
I got it to work. Thanks for the help!

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 26132
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

keep unread flags

Post by Paul »

MOD Updated to version 2.0.7
See first post for Download Link
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

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

Re: keep unread flags

Post by asinshesq »

Thanks for validating this version.

Here's the changelog from the last version:

Code: Select all

##   2007-07-04 - Version 2.0.7
##		- Fixed bug that sometimes resulted in a users's own posts being shown as unread after
##		  'mark all topics read' link is clicked;
##		- Fixed timing bug that sometimes caused a whole topic to be marked as read when you 
##		  reply to a post in the middle and sometimes caused problems when other people post
##		  in a topic while you were replying to a post in that topic
For anyone already running an older version of this mod, I include In the contrib folder upgrade scripts showing how to upgrade from earlier versions up to version 2.0.7.

nouveau
Registered User
Posts: 256
Joined: Tue Mar 27, 2007 1:51 pm

Re: keep unread flags

Post by nouveau »

Hi,

I've just installed this mod and I think it is working, however, instant redirect is no longer working as it should. I will go straigt to the first post in a topic instead of the last post created by the poster.

This is the code in my posting.php file where I need to make the changes.

Code: Select all

		if ( $mode == 'newtopic' || $mode == 'reply' )
		{
			$tracking_topics = ( !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
			$tracking_forums = ( !empty($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();

			if ( count($tracking_topics) + count($tracking_forums) == 100 && empty($tracking_topics[$topic_id]) )
			{
				asort($tracking_topics);
				unset($tracking_topics[key($tracking_topics)]);
			}

			$tracking_topics[$topic_id] = time();

			setcookie($board_config['cookie_name'] . '_t', serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
			//-- mod : Instant Post Redirect ------------------------------------------------------------
			//-- add
			redirect(append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=$post_id", true) . '#' . $post_id);
			//-- fin mod : Instant Post Redirect --------------------------------------------------------
		}
Any help would be great.
Formerly known as xceler8shun

Post Reply

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