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

Re: keep unread flags

Post by asinshesq » Sat Oct 20, 2007 6:26 pm

rantbot wrote:The "files to edit" list doesn't mention the database. However I see there is an SQL mod.
Right, the database is not a file to edit. The files are the .php and .tpl files underneath your phpbb2 folder.
rantbot wrote:How is that done? Do I just paste the text

ALTER TABLE phpbb_users ADD user_unread_topics TEXT;

into the Query window Run SQL query/queries on server localhost: in phpMyAdmin and run it from there?
Open the database for your forum on phpmyadmin and then click the 'SQL' tab (not the 'QUERY' tab) that appears towards the top. Then paste that text in the window and click the GO button.

By the way, if you use easymod, it will do all that for you.

rantbot
Registered User
Posts: 83
Joined: Sun May 07, 2006 1:37 pm

Re: keep unread flags

Post by rantbot » Tue Oct 23, 2007 6:45 pm

asinshesq wrote:By the way, if you use easymod, it will do all that for you.
I didn't use easymod. I made all the changes manually, mainly because mine is no longer a standard installation and I try to keep close track of the details of further mods, especially in the style files as I don't use subSilver. Of course I had to make up an icon to replace the supplied icon_keep_unread.gif, which is styled for subSilver. Everything went pretty well. I noticed two peculiarities, though.

1. The modification to viewforum.php doesn't seem quite right. Part of the bit to be replaced includes this comment -

Code: Select all

//
// Handle marking posts
//
The new stuff which gets pasted in doesn't include such a comment. Since the code seemed to still be concerned with handling marking of posts, and it added this comment back in -

Code: Select all

//
// End handle marking posts
//
I left the Handle marking posts comment in.

2. language/lang_english/lang_main.php caused an error at the new added lines,

Code: Select all

//MOD Keep_unread
$lang['keep_post_unread_explain'] = 'Mark post as unread';
$lang['keep_unread_done'] = 'The post has been marked as unread.';
$lang['View_unread_posts'] = 'View unread posts';
$lang['No_unread_posts'] = 'You have no unread posts';
I moved them up above the

Code: Select all

//
// That's all, Folks!
// -------------------------------------------------
and the error went away.

Everything seems to be working fine. Thanks for the help, guys.

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

Re: keep unread flags

Post by asinshesq » Tue Oct 23, 2007 8:31 pm

rantbot wrote:...I noticed two peculiarities, though.

1. The modification to viewforum.php doesn't seem quite right. Part of the bit to be replaced includes this comment -

Code: Select all

//
// Handle marking posts
//
The new stuff which gets pasted in doesn't include such a comment. Since the code seemed to still be concerned with handling marking of posts, and it added this comment back in -

Code: Select all

//
// End handle marking posts
//
I left the Handle marking posts comment in.
Comments are skipped when php code is executed, so you can safely put in that or any other comment and nothing bad will happen. As to why we deleted that comment, it's because we instead inserted a comment a bit later that reads:

Code: Select all

//Mark this forum as read
But again, feel free to add whatever other comments you want and your code will still execute fine.
rantbot wrote:...2. language/lang_english/lang_main.php caused an error at the new added lines,

Code: Select all

//MOD Keep_unread
$lang['keep_post_unread_explain'] = 'Mark post as unread';
$lang['keep_unread_done'] = 'The post has been marked as unread.';
$lang['View_unread_posts'] = 'View unread posts';
$lang['No_unread_posts'] = 'You have no unread posts';
I moved them up above the

Code: Select all

//
// That's all, Folks!
// -------------------------------------------------
and the error went away.
Moving it above is fine, but where the mod tells you to put it is fine too. My guess is that when the mod told you to put it BEFORE the final ?> in lang_main.phpo, you inadverttenly put it after. Since the last line on any php page must read like this:
?>
adding those lines after rather than before will result in an error.

computersOC
Registered User
Posts: 2528
Joined: Thu Dec 04, 2003 6:21 am
Location: New York
Contact:

Re: keep unread flags

Post by computersOC » Tue Oct 23, 2007 8:33 pm

Can someone tell me what code to change if I don't want the read/unread flag image to show to guests? Thanks.
http://www.computersOC.com - overclocking, P2P, broadband tweaks, ISP forums, more... Computer Building Help -- Overclocking Guide

Want us to install you a phpBB board or update your current one? Want mods/anti-spam mods installed? Moving to a new host? Check us out here.

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

Re: keep unread flags

Post by asinshesq » Tue Oct 23, 2007 8:40 pm

computersOC wrote:Can someone tell me what code to change if I don't want the read/unread flag image to show to guests? Thanks.
This is from the author's notes on the 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 : ''),

computersOC
Registered User
Posts: 2528
Joined: Thu Dec 04, 2003 6:21 am
Location: New York
Contact:

Re: keep unread flags

Post by computersOC » Thu Oct 25, 2007 2:04 am

asinshesq wrote:
computersOC wrote:Can someone tell me what code to change if I don't want the read/unread flag image to show to guests? Thanks.
This is from the author's notes on the 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 : ''),
That only does it for viewtopic.php, I meant for index.php. Thanks.
http://www.computersOC.com - overclocking, P2P, broadband tweaks, ISP forums, more... Computer Building Help -- Overclocking Guide

Want us to install you a phpBB board or update your current one? Want mods/anti-spam mods installed? Moving to a new host? Check us out here.

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

Re: keep unread flags

Post by Merlin Sythove » Thu Oct 25, 2007 6:05 am

computersOC wrote:That only does it for viewtopic.php, I meant for index.php. Thanks.
Do you KNOW or are you only guessing from reading the above code, without knowing how the whole mod works?
Need custom work done? Pimp My Forum!

computersOC
Registered User
Posts: 2528
Joined: Thu Dec 04, 2003 6:21 am
Location: New York
Contact:

Re: keep unread flags

Post by computersOC » Thu Oct 25, 2007 7:52 am

Yes. I don't want the image showing AT ALL on the index.php page. I did that change already way back when. It makes it so the image shows to guests, but it says unread. I want to kill the image completely for guests. I just want the image to show read or unread for users logged in.
http://www.computersOC.com - overclocking, P2P, broadband tweaks, ISP forums, more... Computer Building Help -- Overclocking Guide

Want us to install you a phpBB board or update your current one? Want mods/anti-spam mods installed? Moving to a new host? Check us out here.

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

Re: keep unread flags

Post by asinshesq » Thu Oct 25, 2007 10:13 am

That bit of code changes things so that for guests it works the way phpbb works without the mod - i.e. guests do not see any unread (yellow) flags. If your guests are seeing unread (yellow) flags, you did something wrong.

Now, you say your guests are seeing 'unread' flags, but perhaps you really mean they are seeing a clear (not yellow) circle with a clear folder inside it ... assuming you are using subSilver a guest should see that to the left of all forums in index and to the left of all topics in viewforum. That's the way phpbb works without this mod.

It is true that phpbb without the mod shows the text 'no new posts' to a guest when a guest hovers the mouse over that image...is that what you are complaining about? If so, that has nothing to do with this mod but it should be easy for you to figure out how to get rid of it if you really care.

computersOC
Registered User
Posts: 2528
Joined: Thu Dec 04, 2003 6:21 am
Location: New York
Contact:

Re: keep unread flags

Post by computersOC » Thu Oct 25, 2007 1:14 pm

Yeah, that's what I'm talking about. I can't edit the .tpl because there is something already there surrounding the image, so I can't use the code for saying somebody is logged in/logged out to make it show/not show.
http://www.computersOC.com - overclocking, P2P, broadband tweaks, ISP forums, more... Computer Building Help -- Overclocking Guide

Want us to install you a phpBB board or update your current one? Want mods/anti-spam mods installed? Moving to a new host? Check us out here.

rantbot
Registered User
Posts: 83
Joined: Sun May 07, 2006 1:37 pm

Re: keep unread flags

Post by rantbot » Fri Oct 26, 2007 12:42 pm

My users are already complaining that the "View posts since last visit" function has disappeared, replaced by "View unread posts". Can they both remain functional?

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

Re: keep unread flags

Post by asinshesq » Fri Oct 26, 2007 1:23 pm

rantbot wrote:My users are already complaining that the "View posts since last visit" function has disappeared, replaced by "View unread posts". Can they both remain functional?
This mod replaces the code for that functionality, so retaining that functionality is not as straightforward as sticking a link on the index page. Yes, you could write a mod that would give you back that functionality along with keep unread functionality. You could even write a mod that wouid give you that functionality using the database rather than cookies. But that is a totally different mod and since I don't need it for my boards I won't be writing it (sorry). Merlin, please give me a reality check: do you agree that it would take a fair amount of coding to add back that functionality?

If you know how to code yourself, I suspect the easiest way to retain both functions would be to have the old function use cookies (like it does in a plain vanilla phpbb board) and the new function use the database. You would then keep most of the code that this mod has you replace or comment out - so that the old code would continue to track new posts info in the cookies and the new code from this mod would track unread post info in the database. Probably not too difficult if you know how to code, but I don't think it's totally straightforward either.

On a side note, I understand that people are used to a certain behavior and then are nonplussed when the behavior changes. But giving people the old function along with the new would, in my view, be highly highly confusing. In lieu of doing that, you might be better off installing the mod that gives you a drop down menu (at the bottom of the index page) allowing the user to view all posts made in the last _____ hours/days/weeks/months. I have that on my board (and I have drop down times for posts in the last 15 minutes/30 minutes/ 45 minutes/ 1 hour/ 2 hours/ 6 hours/ 12 hours/ 1 day/ 7 days/ 1 month). I find that useful when I am looking for posts made within a certain amount of time.

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

Re: keep unread flags

Post by Merlin Sythove » Fri Oct 26, 2007 1:51 pm

I'm fairly sure the question was asked and has been answered in this topic. It is not too difficult to change the function list_new_unreads into a version that uses a flag to get proper unread topics, or just the newest ones "old style". From there, one extra link would probably do the trick. I seem to remember having done it, and I do in fact have that functionality on my own board, but implemented differently.

But...

The proper question to ask, like asinshesq does, is whether your users really want that, or whether the less computer-savvy shout HELP no matter what you change.

The unread post functionality does exactly what it says: it keeps unread posts unread, even when you leave the forum. If you don't want that, then when you leave, go to the index, click "mark all forums as read" and Bob's your uncle. I suggest you explain this option to your users, so that they realise they do now have full control over what they keep unread, and what they don't want to read, whilst the old default phpBB behaviour had some quirks that made you lose all unread posts from time to time.
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 » Fri Oct 26, 2007 2:10 pm

computersOC wrote:Yeah, that's what I'm talking about. I can't edit the .tpl because there is something already there surrounding the image, so I can't use the code for saying somebody is logged in/logged out to make it show/not show.
If you're just trying to get rid of the alt text that comes up when a guest moves the mouse over the circle with a folder inside, you can try this (I haven't tried it but it should work):

Code: Select all

OPEN
index.php

FIND
$folder_alt = ( $unread_topic ) ? $lang['New_posts'] : $lang['No_new_posts'];

REPLACE WITH
$folder_alt = '';
if ( $userdata['session_logged_in'] )
{
	$folder_alt = ( $unread_topic ) ? $lang['New_posts'] : $lang['No_new_posts'];
}

OPEN
viewforum.php

FIND
$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];

REPLACE WITH
$no_new_posts_text = ( $userdata['session_logged_in'] ) $lang['No_new_posts'] : '';
$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $no_new_posts_text;

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

Re: keep unread flags

Post by asinshesq » Fri Oct 26, 2007 2:14 pm

Merlin Sythove wrote:...It is not too difficult to change the function list_new_unreads into a version that uses a flag to get proper unread topics, or just the newest ones "old style"...
How well defined is the 'newest ones "old style"'? Unmodded phpbb is buggy on this; are you clear on when it should in theory measure from if implemented correctly?

Post Reply

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