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

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

Post by asinshesq »

Samsa wrote:
asinshesq wrote:
Samsa wrote:Hello folks,

This mod strangely doesn't work on my forum and I don't understand why. I have no error message of any kind, the features of the mod appear normally on the board but I can't post anymore and when I logout, I can't login anymore: in both cases the posting page and the index page show a blank screen.

Precision: in the database, the field "user_unread_topics" remains NULL.

Thanks for your help.


My standard advice if you didn't use easymod: go back to your backup files and then install this with easymod.

I didn't use easymod indeed but I have a clean board and so I simply copied the changed files that are supplied for this mod. I just modified the search.php following your instructions.


If you have a clean 2.0.20 board that will not work, since those files are for 2.0.19. If that's what you did, I suggest you go back to a clean 2.0.20 set of files, make the changes in the mod script I describe above and then install via easymod.
Samsa
Registered User
Posts: 3
Joined: Fri May 19, 2006 5:20 pm

Post by Samsa »

Ok I will do that. But when you write:
2. If you are trying to install keep unread on a board that has already been upgraded to 2.0.20, then:

doesn't it imply that search.php is the only file to modify and therefore the other files for 2.0.19 are good also for 2.0.20?
daisy84
Registered User
Posts: 129
Joined: Thu Sep 29, 2005 6:03 am

Post by daisy84 »

asinshesq thank you very much. I made the change and all is working great.
:)
DrthVictor
Registered User
Posts: 13
Joined: Sat Jan 22, 2005 7:28 pm

Keep unread and banned users

Post by DrthVictor »

I have been testing new board, and with this mod installed, I get the "message_die() was called multiple times" message. I installed the mod to display what the errors are, and it showed:

Code: Select all

Critical Error!
message_die() was called multiple times.
 
--------------------------------------------------------------------------------
Error #1 
You_been_banned 

 
--------------------------------------------------------------------------------
 Error #2 
Could not query new topic information 

Line : 1510
File : /home/.cuckoo/.../.../includes/functions.php 
SQL : SELECT t.forum_id, t.topic_id, p.post_time FROM phpbb_topics t, phpbb_posts p WHERE p.post_id = t.topic_last_post_id AND (p.post_time > ) AND t.topic_moved_id = 0 
 
--------------------------------------------------------------------------------
 Please, contact the webmaster. Thank you.
--------------------------------------------------------------------------------

(my domain and user directory were purposefully deleted)

So, it appears that list_new_unreads needs to check to make sure a user is not banned before it attempts to run. Does anyone know how to make it do this?
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

Samsa wrote: Ok I will do that. But when you write:
2. If you are trying to install keep unread on a board that has already been upgraded to 2.0.20, then:

doesn't it imply that search.php is the only file to modify and therefore the other files for 2.0.19 are good also for 2.0.20?


No, it implies what it says: you need to change the mod script in the way I describe. The separate files are clearly marked as files for 2.0.19 so you sould not be using them.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Keep unread and banned users

Post by asinshesq »

DrthVictor wrote: I have been testing new board, and with this mod installed, I get the "message_die() was called multiple times" message. I installed the mod to display what the errors are, and it showed:

Code: Select all

Critical Error!
message_die() was called multiple times.
 
--------------------------------------------------------------------------------
Error #1 
You_been_banned 

 
--------------------------------------------------------------------------------
 Error #2 
Could not query new topic information 

Line : 1510
File : /home/.cuckoo/.../.../includes/functions.php 
SQL : SELECT t.forum_id, t.topic_id, p.post_time FROM phpbb_topics t, phpbb_posts p WHERE p.post_id = t.topic_last_post_id AND (p.post_time > ) AND t.topic_moved_id = 0 
 
--------------------------------------------------------------------------------
 Please, contact the webmaster. Thank you.
--------------------------------------------------------------------------------

(my domain and user directory were purposefully deleted)

So, it appears that list_new_unreads needs to check to make sure a user is not banned before it attempts to run. Does anyone know how to make it do this?


I think you're looking for the wrong thing. This mod does not do anything with banned user info, and your sql looks like it is incomplete. Ny guess is you installed this wrong. Did you use easymod? If not, I suggest you go back to your backup files and reinstall with easymod so you don't have to look for a needle in a haystack. If you used easymod, you probably made a mistake in adapting the script to your board.
DrthVictor
Registered User
Posts: 13
Joined: Sat Jan 22, 2005 7:28 pm

Re: Keep unread and banned users

Post by DrthVictor »

asinshesq wrote:
DrthVictor wrote:I have been testing new board, and with this mod installed, I get the "message_die() was called multiple times" message. I installed the mod to display what the errors are, and it showed:

Code: Select all

Critical Error!
message_die() was called multiple times.
 
--------------------------------------------------------------------------------
Error #1 
You_been_banned 

 
--------------------------------------------------------------------------------
 Error #2 
Could not query new topic information 

Line : 1510
File : /home/.cuckoo/.../.../includes/functions.php 
SQL : SELECT t.forum_id, t.topic_id, p.post_time FROM phpbb_topics t, phpbb_posts p WHERE p.post_id = t.topic_last_post_id AND (p.post_time > ) AND t.topic_moved_id = 0 
 
--------------------------------------------------------------------------------
 Please, contact the webmaster. Thank you.
--------------------------------------------------------------------------------

(my domain and user directory were purposefully deleted)

So, it appears that list_new_unreads needs to check to make sure a user is not banned before it attempts to run. Does anyone know how to make it do this?


I think you're looking for the wrong thing. This mod does not do anything with banned user info, and your sql looks like it is incomplete. Ny guess is you installed this wrong. Did you use easymod? If not, I suggest you go back to your backup files and reinstall with easymod so you don't have to look for a needle in a haystack. If you used easymod, you probably made a mistake in adapting the script to your board.


I install all my mods with easymod when possible. Although the mod does not touch any banning functionality, being banned seems to put the user into a state where the variables in list_new_unreads() get hosed.

The issue is that a banned user gets a message_die() error when they attempt to access the board. They also get a message_die() when the sql can't be completed - in this case because banned seems to be messing with $tracking_time. phpBB fails when there are two message_die() calls.

I know the mod does not touch any banning functionality. The problem is that being banned seems to mess with the variables in the script, causing message_die() to happen twice and not load phpBB. Unfortunately, I don't know quite enough php to resolve it myself.
DrthVictor
Registered User
Posts: 13
Joined: Sat Jan 22, 2005 7:28 pm

Post by DrthVictor »

Also, to follow up, everything works fine for the banned user if I do the instructions to not allow guests to keep topics unread.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

DrthVictor, sorry but I'm not following you at all. I just tried banning a test user on my board and as expected, when I try to log in the test user I get the usual you've been banned message without any error message. Are you saying that when you ban a user and try to log the banned user in you get an error message related to this mod? Or are you talking about other users once you have banned a particular user? :?: :?:
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq »

DrthVictor wrote: Also, to follow up, everything works fine for the banned user if I do the instructions to not allow guests to keep topics unread.


What does everything works fine for the banned user mean? Do you just mean he gets the banned user message when he tries to log in, or something else?
DrthVictor
Registered User
Posts: 13
Joined: Sat Jan 22, 2005 7:28 pm

Post by DrthVictor »

asinshesq wrote:
DrthVictor wrote:Also, to follow up, everything works fine for the banned user if I do the instructions to not allow guests to keep topics unread.


What does everything works fine for the banned user mean? Do you just mean he gets the banned user message when he tries to log in, or something else?

The banned user does not get the message_die() was called multiple times and gets the ban notification as he should. But I have since learned that this is only if he tries a new login.

I am sorry if I am being confusing here. I am of the opinion that the issue stems from something of the mod, and not from an error on my part (not because I am perfect, but because I am dilligent and double-checked before I posted). I think this is a great mod, so I am not trying to speak poorly of it, but help identify a possible issue.

I tried approaching this a different way and maybe you can see if this helps you reproduce the problem.

I logged in my test user in IE. When I logged in, I checked the "Remember Me" box so the cookie would be set. I then navigated away from the site.

Meanwhile, in Firefox, I logged into my admin account and banned the test user.

I went back to IE to the test user and returned to the site. This is when I got the message_die() error.

Can you see if this yields the same results for you?

Thanks for all of your prompt attention, btw :)
net83it
Registered User
Posts: 500
Joined: Sun Jan 15, 2006 2:42 pm
Location: Sicily
Contact:

Post by net83it »

niksa wrote:
If you are running the split topic type mod, the topic calendar mod, the profile control panel or any other mod that installs a file called functions_topic_list.php' in your includes/ directory, you need to install the mod_for_functions_topics_list after you have already installed this mod (that mod has not yet been written and may never be)


Ok, this is what I did on my board (I have split topics type v2.0.1). It's not a huge difference but it SEEMS to be working so far. I've only tested it superficially through a day of light usage but I haven't seen any problems at all.

DON'T do this in viewforum.php (since it's commented out anyway):

Code: Select all

#
#-----[ FIND ]------------------------------------------------
#
			$newest_post_img = '';
			if( $userdata['session_logged_in'] )
			{
				if( $topic_rowset[$i]['post_time'] > $userdata['user_lastvisit'] ) 
				{
					if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
					{
						$unread_topics = true;

						if( !empty($tracking_topics[$topic_id]) )
						{
							if( $tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time'] )
							{
								$unread_topics = false;
							}
						}

						if( !empty($tracking_forums[$forum_id]) )
						{
							if( $tracking_forums[$forum_id] >= $topic_rowset[$i]['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'] >= $topic_rowset[$i]['post_time'] )
							{
								$unread_topics = false;
							}
						}

						if( $unread_topics )
						{
							$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 = '';
						}
					}
					else
					{
						$folder_image = $folder_new;
						$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $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 = '';
				}
			}
			else
			{
				$folder_image = $folder;
				$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];

				$newest_post_img = '';
			}
			
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
			//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
Instead, in includes/functions_topic_list.php, FIND this:

Code: Select all

		$newest_post_img = '';
			if ( $userdata['session_logged_in'] && ($topic_item_type == POST_TOPIC_URL) )
			{
				if( $topic_rowset[$i]['post_time'] > $userdata['user_lastvisit'] ) 
				{
					if( !empty($tracking_topics) || !empty($tracking_forums) || !empty($tracking_all) )
					{
						$unread_topics = true;
						if( !empty($tracking_topics[$topic_id]) )
						{
							if( $tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time'] )
							{
								$unread_topics = false;
							}
						}
						if( !empty($tracking_forums[$forum_id]) )
						{
							if( $tracking_forums[$forum_id] >= $topic_rowset[$i]['post_time'] )
							{
								$unread_topics = false;
							}
						}
						if( !empty($tracking_all) )
						{
							if( $tracking_all >= $topic_rowset[$i]['post_time'] )
							{
								$unread_topics = false;
							}
						}
						if ( $unread_topics )
						{
							$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 = '';
						}
					}
					else
					{
						$folder_image = $folder_new;
						$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $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 = '';
				}
			}
			else
			{
				$folder_image = $folder;
				$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
				$newest_post_img = '';
			}
REPLACE with this:

Code: Select all

			//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
And do the rest of the installation as directed. If you want to use easymod, just make those changes to the install text.

Ok, now that is what I did to make it work on my board. I don't know if it will work for anyone else's, but I thought I would post this in case it hasn't been posted earlier on the beta thread.

Anyway, I hope this is helpful. 8)

And also - this is an awesome mod! I thought I was never going to be able to add in the older version of unread flags, so I gave up on it months ago. I'm so happy you made this. :D


it doesn't work on my forum

i have a functions_topics_list.php (notice the 's') file in my includes/ directory due to simply merge mod. with the modification you suggested the keep unread mod doesn't work properly.
net83it
Registered User
Posts: 500
Joined: Sun Jan 15, 2006 2:42 pm
Location: Sicily
Contact:

Post by net83it »

i have a question for the author of this mod
## NOTE: this mod stores keep unread info for guests in their cookies; some people want to
## disable this mod for guests altogether (I guess as an incentive to register); in order
## to turn off this mod for guests, install the mod in the usual way and then do this:
##
## OPEN
## includes/functions.php
##
## FIND
## return $new_unreads;
##
## REPLACE WITH
## return ($userdata['session_logged_in'] ? $new_unreads : array());
##
## FIND
## return $t;
##
## REPLACE WITH
## return ($userdata['session_logged_in'] ? $t: time());
##
## OPEN viewtopic.php
##
## FIND
## 'KEEP_UNREAD_IMG' => $keep_unread_img,
##
## REPLACE WITH
## 'KEEP_UNREAD_IMG' => ($userdata['session_logged_in'] ? $keep_unread_img : ''),


what happens when i disable this mod for the guest? do they still see new posts when visit the forum? and if they don't read these new posts what happens when they re-visit the forum? the posts are marked as read?

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

Post by asinshesq »

DrthVictor wrote: ...I tried approaching this a different way and maybe you can see if this helps you reproduce the problem.

I logged in my test user in IE. When I logged in, I checked the "Remember Me" box so the cookie would be set. I then navigated away from the site.

Meanwhile, in Firefox, I logged into my admin account and banned the test user.

I went back to IE to the test user and returned to the site. This is when I got the message_die() error.

Can you see if this yields the same results for you?

Thanks for all of your prompt attention, btw :)


Thanks, because of your careful instructions I was able to replicate the problem you report. It only happens when you use the mod to the mod that changes the link when you have unread posts. Give this a try and see if that fixes it:

Code: Select all

OPEN
includes/page_header.php

FIND
//START MOD Keep_unread_2
$have_unreads = (list_new_unreads($forum_unreads, true)) ? true : false;
//END MOD Keep_unread_2

REPLACE WITH
//START MOD Keep_unread_2
if ( !isset($omit_unreads_check) )
{
	$have_unreads = (list_new_unreads($forum_unreads, true)) ? true : false;
}
//END MOD Keep_unread_2

OPEN
functions.php

FIND
		//
		// Load the Page Header
		//
		if ( !defined('IN_ADMIN') )
		{
			include($phpbb_root_path . 'includes/page_header.'.$phpEx);

BEFORE, ADD
		$omit_unreads_check = true;
This is only for people who are using the mod to the mod.
DrthVictor
Registered User
Posts: 13
Joined: Sat Jan 22, 2005 7:28 pm

Post by DrthVictor »

Seems like that did the trick. Thanks a lot!
Post Reply

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