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

schwim
Registered User
Posts: 120
Joined: Sat Jun 04, 2005 8:03 am

Re: keep unread flags

Post by schwim »

Hi there,

I think I might have messed up the install somewhat, but don't know where to look.

I installed the mod, made the necessary chances to get the instant redirect mod working again, then tested it. I posted a thread and then went back to the forum after viewing. It shows up as unread to me.

I viewed the forum, and my post showed as unread to me.

I viewed it in a different browser, and I couldn't get it to change to read for anonymous either.

I tried viewing unread posts, and no results matched my criteria.

Then I clicked the "Mark all topics read", and received the following errors:
Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/rogue/public_html/forum/viewforum.php on line 126

Warning: implode() [function.implode]: Bad arguments. in /home/rogue/public_html/forum/viewforum.php on line 126

Warning: Cannot modify header information - headers already sent by (output started at /home/rogue/public_html/forum/viewforum.php:126) in /home/rogue/public_html/forum/includes/page_header.php on line 517

Warning: Cannot modify header information - headers already sent by (output started at /home/rogue/public_html/forum/viewforum.php:126) in /home/rogue/public_html/forum/includes/page_header.php on line 519

Warning: Cannot modify header information - headers already sent by (output started at /home/rogue/public_html/forum/viewforum.php:126) in /home/rogue/public_html/forum/includes/page_header.php on line 520

Warning: Cannot modify header information - headers already sent by (output started at /home/rogue/public_html/forum/viewforum.php:126) in /home/rogue/public_html/forum/includes/page_header.php on line 521
code, from line 500-550:

Code: Select all

				$folder_new = $images['folder_announce_new'];
			}
			else if( $topic_rowset[$i]['topic_type'] == POST_STICKY )
			{
				$folder = $images['folder_sticky'];
				$folder_new = $images['folder_sticky_new'];
			}
			else if( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED )
			{
				$folder = $images['folder_locked'];
				$folder_new = $images['folder_locked_new'];
			}
			else
			{
				if($replies >= $board_config['hot_threshold'])
				{
					$folder = $images['folder_hot'];
					$folder_new = $images['folder_hot_new'];
				}
				else
				{
					$folder = $images['folder'];
					$folder_new = $images['folder_new'];
				}
			}

			//START MOD Keep_unread_2
			if( $topic_rowset[$i]['post_time'] > topic_last_read($forum_id, $topic_id) )
			{
				$folder_image = $folder_new;
				$folder_alt = $lang['New_posts'];
				$newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
			}
			else
			{
				$folder_image = $folder;
				$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
				$newest_post_img = '';
			}
			//END MOD Keep_unread_2
		}

		if( ( $replies + 1 ) > $board_config['posts_per_page'] )
		{
			$total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
			$goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';

			$times = 1;
			for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
			{
I'm not sure where to begin looking for my mistake. I would greatly appreciate any help you can provide and will be happy to provide more info if needed.

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

Re: keep unread flags

Post by Merlin Sythove »

You probably made mistakes in functions.php. The fact that posts are not seen as read, and the array is not defined, point in that direction.
Need custom work done? Pimp My Forum!
schwim
Registered User
Posts: 120
Joined: Sat Jun 04, 2005 8:03 am

Re: keep unread flags

Post by schwim »

Hi there Merlin,

Thanks very much for the reply.

I've looked through functions.php and although I'm sure I'm missing something, I can't see it.

You can see the file(txt ver.) here. If anyone sees where I've messed it up, I'd appreciate the pointer! :)

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

Re: keep unread flags

Post by asinshesq »

schwim wrote:Hi there Merlin,

Thanks very much for the reply.

I've looked through functions.php and although I'm sure I'm missing something, I can't see it.

You can see the file(txt ver.) here. If anyone sees where I've messed it up, I'd appreciate the pointer! :)

Thanks again,
json
How about zipping up all of the files that this mod has you edit and giving us a link for that zip file. Then I'll take a look when I get a chance (though that may not be for a few days).
schwim
Registered User
Posts: 120
Joined: Sat Jun 04, 2005 8:03 am

Re: keep unread flags

Post by schwim »

Hi there,

You can find all the modded files here.

I appreciate the help anyone can provide, since I broke my deal :)

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

Re: keep unread flags

Post by asinshesq »

schwim wrote:Hi there Merlin,

Thanks very much for the reply.

I've looked through functions.php and although I'm sure I'm missing something, I can't see it.

You can see the file(txt ver.) here. If anyone sees where I've messed it up, I'd appreciate the pointer! :)

Thanks again,
json
You didn't check over your edits to functions.php carefully enough ;)

Try this:

Code: Select all

OPEN

includes/functions.php

FIND
		//MOD Keep_unread_2
		read_cookies($userdata);
		
	}


REPLACE WITH
	}
	
	//MOD Keep_unread_2
	read_cookies($userdata);
(The keep unread stuff goes after the close bracket, not before.)
schwim
Registered User
Posts: 120
Joined: Sat Jun 04, 2005 8:03 am

Re: keep unread flags

Post by schwim »

Wow, and I didn't do that once, I did it three times(my other attempts to edit the file).

I can't thank you enough. I've posted, marked it read and it seems to be flagging it as read properly now.

Thanks again,
json
marian0810
Former Team Member
Posts: 3011
Joined: Mon May 21, 2007 9:17 pm
Location: The Netherlands
Name: Marian
Contact:

Re: keep unread flags

Post by marian0810 »

I was wondering if it's possible to make some kind of distinction between "searching the forums" and "viewing unread posts" in viewonline.php?
Right now everyone who's viewing his unread posts shows up as searching, and so do people who actually use the search function. I'd like to be able to see which one of those they're actually doing.
You and me, time and space. You watch us run!
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: keep unread flags

Post by Merlin Sythove »

Near the top of search.php you find this line:
$userdata = session_pagestart($user_ip, PAGE_SEARCH);

1. The constant PAGE_SEARCH is defined in constants.php. if you add a new one,
2. and a language item below $lang['Searching_forums'],
3. and alter the above line to show your new constant if the keep_unread function is in use,
4. and update viewonline.php, you've got it.

So four changes to make, that is all.
Point 3 is the most complicated:
find this

Code: Select all

$search_id = ( isset($HTTP_GET_VARS['search_id']) ) 
	? $HTTP_GET_VARS['search_id'] 
	: ( isset($HTTP_POST_VARS['search_id']) ? $HTTP_POST_VARS['search_id'] : '');
and move it BEFORE

Code: Select all

$userdata = session_pagestart($user_ip, PAGE_SEARCH);
and change this

Code: Select all

$userdata = session_pagestart($user_ip, PAGE_SEARCH);
to

Code: Select all

$userdata = session_pagestart($user_ip, ($search_id == 'newposts' ? PAGE_SEARCH_NEWPOSTS : PAGE_SEARCH));
and go on to define PAGE_SEARCH_NEWPOSTS in step 1 etc. Anyway, the above are just hints and tips for people who can code in php but need tips! It is not a mod, don't try to do this if you can't code.

And sorry that I can't go further than this, but since phpBB 3 has been launched I have ditched all pretense at keeping my forum compatible with the original phpBB 2, instead I have been improving it quite drastically and my code no longer reflects the 'out of the box' original phpBB 2.
Need custom work done? Pimp My Forum!
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: keep unread flags

Post by asinshesq »

marian0810 wrote:I was wondering if it's possible to make some kind of distinction between "searching the forums" and "viewing unread posts" in viewonline.php?
Right now everyone who's viewing his unread posts shows up as searching, and so do people who actually use the search function. I'd like to be able to see which one of those they're actually doing.
Try this (I haven't tried it but it should work if I haven't run into my normal typos...let us know):

Code: Select all

OPEN
search.php

FIND
$userdata = session_pagestart($user_ip, PAGE_SEARCH);

REPLACE WITH
$search_id = ( isset($HTTP_GET_VARS['search_id']) ) ? $HTTP_GET_VARS['search_id'] : '';
$page_search = ( $search_id != 'newposts' ) ? PAGE_SEARCH : PAGE_UNREAD;
$userdata = session_pagestart($user_ip, $page_search);

FIND amd DELETE
$search_id = ( isset($HTTP_GET_VARS['search_id']) ) ? $HTTP_GET_VARS['search_id'] : '';

OPEN
includes/constants.php

FIND
define('PAGE_GROUPCP', -11);

AFTER, ADD
define('PAGE_UNREAD', -100);

OPEN
viewonline.php

FIND
				case PAGE_SEARCH:
					$location = $lang['Searching_forums'];
					$location_url = "search.$phpEx";
					break;

AFTER, ADD
				case PAGE_UNREAD:
					$location = $lang['Searching_unreads'];
					$location_url = "search.$phpEx";
					break;

OPEN
language/lang_english/lang_main.php

FIND
$lang['Searching_forums'] = 'Searching forums';

AFTER, ADD
$lang['Searching_unreads'] = 'Viewing unread posts';
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: keep unread flags

Post by asinshesq »

Sorry, I see that Merlin has already done this. But looking at his code, it appears we did it the same way ;)
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: keep unread flags

Post by Merlin Sythove »

Great minds think alike :-)
At least you have the correct phpBB code to start with, I would have to hunt for it. And yes, you have the same four steps. Whieie, there is method in the madness :-)
Need custom work done? Pimp My Forum!
marian0810
Former Team Member
Posts: 3011
Joined: Mon May 21, 2007 9:17 pm
Location: The Netherlands
Name: Marian
Contact:

Re: keep unread flags

Post by marian0810 »

asinshesq wrote:...let us know)
Thanks a lot, it works perfectly! :D
You and me, time and space. You watch us run!
User avatar
Dogs and things
Registered User
Posts: 2114
Joined: Fri Sep 01, 2006 9:04 am
Location: Spain
Contact:

Re: keep unread flags

Post by Dogs and things »

Nice idea Marian, ;)

And thanks for the great support you´re giving to your MODs, great minds! :P
For phpBB2 support visit phpBB2refugees.
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: keep unread flags

Post by Merlin Sythove »

Ha, I've just added it myself, thought it would be handy :-)
Need custom work done? Pimp My Forum!
Post Reply

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