Page 124 of 133

Re: keep unread flags

Posted: Sat Oct 20, 2007 6:26 pm
by asinshesq
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.

Re: keep unread flags

Posted: Tue Oct 23, 2007 6:45 pm
by rantbot
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.

Re: keep unread flags

Posted: Tue Oct 23, 2007 8:31 pm
by asinshesq
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.

Re: keep unread flags

Posted: Tue Oct 23, 2007 8:33 pm
by computersOC
Can someone tell me what code to change if I don't want the read/unread flag image to show to guests? Thanks.

Re: keep unread flags

Posted: Tue Oct 23, 2007 8:40 pm
by asinshesq
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 : ''),

Re: keep unread flags

Posted: Thu Oct 25, 2007 2:04 am
by computersOC
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.

Re: keep unread flags

Posted: Thu Oct 25, 2007 6:05 am
by Merlin Sythove
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?

Re: keep unread flags

Posted: Thu Oct 25, 2007 7:52 am
by computersOC
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.

Re: keep unread flags

Posted: Thu Oct 25, 2007 10:13 am
by asinshesq
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.

Re: keep unread flags

Posted: Thu Oct 25, 2007 1:14 pm
by computersOC
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.

Re: keep unread flags

Posted: Fri Oct 26, 2007 12:42 pm
by rantbot
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?

Re: keep unread flags

Posted: Fri Oct 26, 2007 1:23 pm
by asinshesq
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.

Re: keep unread flags

Posted: Fri Oct 26, 2007 1:51 pm
by Merlin Sythove
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.

Re: keep unread flags

Posted: Fri Oct 26, 2007 2:10 pm
by asinshesq
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;

Re: keep unread flags

Posted: Fri Oct 26, 2007 2:14 pm
by asinshesq
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?