View or mark unread posts

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Locked
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: View or mark unread posts

Post by asinshesq »

Thanks to all about the kind words. I wasn't fishing for compliments (at least I don't think I was ;) ), but much appreciated nonetheless.

A quick update on the problem of globals. I just discovered that the reason I have been having so much trouble with globals is that an unmodded phpbb3 board does not treat global unread flags properly to begin with. If you try this simple experiment with a clean phpbb3 board (no mods on), you will see what I mean:

- start with user A, and mark all forums read (just to keep the troubleshooting logic simple)

- with user B, post a regular post (doesn't matter if it is a reply or a new topic) and a global post

- go back to user A, go into the forum where the new regular post is and confirm that the topic with the new regular post and the topic with the new global announcement show up as unread

- open the topic with the new regular post and then go back to any forum and look at (but don't open) the topic with the new global announcement...surprise, it is not longer shown as unread.

More generally, note that if a forum reads all unread topics in any forum, that triggers code that kills the unread flags for all globals.

Bottom line, phpbb3's regular unread tracking doesn't work properly for globals, and getting this mod to plug the hole may be very tricky (and may require additional queries that could weigh down a big board). I haven't decided yet whether or not to give up on globals entirely or do a partial fix - I can probably get the view unread posts link to toggle depending on whether there is a global that regular phpbb3 is still showing as unread - but in the meantime if you are using version 1.0.5 please disable global checking by doing what I suggested here: http://www.phpbb.com/community/viewtopi ... 5#p8006595

[ edit: I see that this phpbb3 bug is in the bugtracker: http://www.phpbb.com/bugs/phpbb3/15729 ]
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

revised version ready for testing...

Post by asinshesq »

If anyone who is running version 1.0.5 wants to test out a revised functions_view_or_mark_unread_posts.php that I am hoping deals properly with globals, here it is (but note that this does NOT attempt to fix the phpbb3 bug I referred to in my prior post, so when the phpbb3 bug bites and an unread global is no longer shown by phpbb3 as unread this mod will not longer treat it as unread):

[edit: code deleted since the revised file is now in the download I have here: http://phpbbmods.asinsh.com/view_or_mar ... 1-0-5c.zip ]

I plan to hold off submitting a revised version for validation until people have had some time to test this and confirm it really works.
Last edited by asinshesq on Tue Dec 30, 2008 2:46 am, edited 5 times in total.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: View or mark unread posts

Post by asinshesq »

While I was at it, I spent some time trying to troubleshoot the phpbb3 global announcement bug. I posted a possible fix here if anyone wants to give it a try: http://www.phpbb.com/community/viewtopi ... &t=1352365

(And by the way, if that works well, I could incorporate it into this mod and that would allow me to save a query relating to globals.)
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: View or mark unread posts

Post by asinshesq »

I've decided that it amkes more sense to incorporate the fix for the global announcement into this mod rather than try to get this mod to work properly despite the global announcements fix. I'll try to post a version 1.0.6 over the weekend if I have time...
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: View or mark unread posts

Post by asinshesq »

The new version of phpbb3 (version 3.0.4) held me up a bit from my plan to post a new version of this mod this weekend. Not sure when I will now get around to it.

By the way, I have tested this mod on phpbb3 version 3.0.4 and it appears to work fine.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: View or mark unread posts

Post by asinshesq »

If anyone wants to test out my [beta] bug fix for phpbb3 properly dealing with global announcements (nothing directly do with this mod but I will incorporate that fix in a future version of this mod), here it is: http://www.phpbb.com/community/viewtopi ... &t=1357705
Last edited by asinshesq on Thu Dec 25, 2008 9:05 pm, edited 1 time in total.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: View or mark unread posts

Post by asinshesq »

I just uploaded a new version 1.0.5b that I hope is more dependible about how it deals with global announcments. You can get 1.0.5b by following the link in this post: http://www.phpbb.com/community/viewtopi ... 5#p8021335

In the download I have included in the contrib folder an upgrade script to take you from 1.0.4 all the way up to 1.0.5b. And if you already have 1.05 or 1.05a installed, all you need to do is to replace the functions_view_or_mark_unread_posts.php file and reapply the two changes that version 1.0.5b has you make to viewtopic.

Please let me know whether this appears to be dependible in how it deals with globals. (But note in this regard that this does NOT fix the regular phpbb3 bug that I referred to in the preceding post.)

Finally, note that if you isntall the beta version of the preserve global unread flags mod that I refer to in the preceding post, you should use the alternate functions_view_or_mark_unread_posts.php file that appears in the contrib/alternate_file folder in the download for version 1.0.5b.
ulong
Registered User
Posts: 59
Joined: Fri Nov 14, 2008 12:22 pm

Re: View or mark unread posts

Post by ulong »

Hi!

When im viewing thread, and i see new posts and posts, which are already read, how to mark unread posts with something, for example text "this post is unread"?
I think i just need something like " <IF POST_UNREAD>this post is unread "or something like that
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: View or mark unread posts

Post by asinshesq »

ulong wrote:When im viewing thread, and i see new posts and posts, which are already read, how to mark unread posts with something, for example text "this post is unread"?
I think i just need something like " <IF POST_UNREAD>this post is unread "or something like that
In viewtopic_body.html, you wold use this if test:
<!-- IF postrow.S_UNREAD_POST --><!-- ENDIF -->

So if you want to hard-code "this post is unread" in there and don't feel like doing it the normal phpbb3 way where phrases get put into a language file, you could do something like this:
<!-- IF postrow.S_UNREAD_POST -->this post is unread<!-- ENDIF -->

The rest of the html to control font size, color, placement, etc. is up to you.
ulong
Registered User
Posts: 59
Joined: Fri Nov 14, 2008 12:22 pm

Re: View or mark unread posts

Post by ulong »

thanks, for answer, im going to test it ;)

And is it possible to show number of unread posts?
For example "You have [xx] unread posts"
Last edited by ulong on Fri Dec 26, 2008 3:33 pm, edited 1 time in total.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: View or mark unread posts

Post by asinshesq »

ulong wrote:And is it possible to show number of unread posts?
For example "You have [xx] unread posts"
As I said in the very first post in this topic (and repeated many times throughout this thread):
The code this mod uses to figure out if there are unread posts is from phpbb3's core code in functions_display(). It is quite efficient and should not weigh down a board. If you change the code to count topics that have unread posts in them, that will begin to weigh down large boards (and may confuse people because the number of topics with unread posts is different from the number of unread posts). And if you change the code to count unread posts (rather than just topics that have unread posts), I suspect that will substantially weigh down boards (perhaps enough to be noticeable on boards that aren't that big). I don't think the overhead is worth it, and as a result I don't plan to add that feature.

However, anyone who wants to write the code is free to do that and post it here for people to try (I don't think it would be that hard if you know your way around php and mysql).
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: View or mark unread posts

Post by asinshesq »

Please do not use the upgrade from 1.0..4 to 1.0.5b script that I included in my latest upload...I found a few mistakes in the update script for viewtopic.php, functions_display.php and the subsilver style changes that I need to clean up first. But the basic 1.0.5b install seems to be stable and working fine.
ulong
Registered User
Posts: 59
Joined: Fri Nov 14, 2008 12:22 pm

Re: View or mark unread posts

Post by ulong »

asinshesq wrote:
ulong wrote:When im viewing thread, and i see new posts and posts, which are already read, how to mark unread posts with something, for example text "this post is unread"?
I think i just need something like " <IF POST_UNREAD>this post is unread "or something like that
In viewtopic_body.html, you wold use this if test:
<!-- IF postrow.S_UNREAD_POST --><!-- ENDIF -->

So if you want to hard-code "this post is unread" in there and don't feel like doing it the normal phpbb3 way where phrases get put into a language file, you could do something like this:
<!-- IF postrow.S_UNREAD_POST -->this post is unread<!-- ENDIF -->

The rest of the html to control font size, color, placement, etc. is up to you.
its working nice! ;)
Thank you

Do u know any else IF, which is checking if there are new private messages?
IF unread private message THEN blabla :)
ulong
Registered User
Posts: 59
Joined: Fri Nov 14, 2008 12:22 pm

Re: View or mark unread posts

Post by ulong »

ulong wrote:
asinshesq wrote:
ulong wrote:When im viewing thread, and i see new posts and posts, which are already read, how to mark unread posts with something, for example text "this post is unread"?
I think i just need something like " <IF POST_UNREAD>this post is unread "or something like that
In viewtopic_body.html, you wold use this if test:
<!-- IF postrow.S_UNREAD_POST --><!-- ENDIF -->

So if you want to hard-code "this post is unread" in there and don't feel like doing it the normal phpbb3 way where phrases get put into a language file, you could do something like this:
<!-- IF postrow.S_UNREAD_POST -->this post is unread<!-- ENDIF -->

The rest of the html to control font size, color, placement, etc. is up to you.
its working nice! ;)
Thank you

Do u know any else IF, which is checking if there are new private messages?
IF unread private message THEN blabla :)
<!-- ELSEIF S_USER_UNREAD_PRIVMSG -->

Great :)

Could u help me, where can i find in database unread posts?

i want to modify

Code: Select all

$sql = 'SELECT COUNT(post_id) as count
    FROM ' . POSTS_TABLE . ' 
		WHERE post_time > ' . $user->data['user_lastvisit'] . '
    AND poster_id != ' . $user->data['user_id'];

$result = $db->sql_query($sql);
$post_count = $db->sql_fetchfield('count', false, $result);
$db->sql_freeresult($result);
To use not post time, but unread posts ;)
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: View or mark unread posts

Post by asinshesq »

ulong wrote:where can i find in database unread posts?
It's the entry in the users table called 'user_unread_privmsg', so you never need to do a sql query for it. Instead, just use $user->data['user_unread_privmsg']. But note that there is already a message that overall_header.php sends to the template that includes the number of unread pms. That message gets assigned in functions.php and is in {PRIVATE_MESSAGE_INFO_UNREAD}

Prosilver doesn't use that message but subsilver2 does...if you switch to subsilver2 you will see a link in the header that reads like this: "xx new messages, yy unread messages" where xx and yy are numbers.

You can use that in prosilver by adding {PRIVATE_MESSAGE_INFO_UNREAD} in the html somewhere...take a look at how subsilver2 does it in overall_header.html.
Locked

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