Is possible to know if a category has unread forums ?

For support and discussion related to templates, themes, and imagesets in phpBB 3.0.
Get Involved
User avatar
Muad''Dib
Registered User
Posts: 311
Joined: Tue Jun 12, 2007 6:20 pm
Contact:

Re: Is possible to know if a category has unread forums ?

Post by Muad''Dib »

Yes i did .. thanks for your input. Ill make the change right away!
User avatar
dpaanlka
Registered User
Posts: 286
Joined: Wed May 10, 2006 6:48 pm
Location: Chicago, USA
Contact:

Re: Is possible to know if a category has unread forums ?

Post by dpaanlka »

So I did this mod to my own board, and it works great except, oddly enough, it seems that only ONE of my many subforums does not trigger the unread category flag.

It's a newer subforum that I created within the past two months - is there some permission or something that I might be missing? Seems odd that all of the other ones, including the other subforums in the same category, trigger the unread flag except just this one.
phpBB user and evangelist since 2005.
My boards: Info-Mac | System 7 Today
njs
Registered User
Posts: 89
Joined: Mon Feb 18, 2008 10:59 pm
Location: Aveiro, Portugal

Re: Is possible to know if a category has unread forums ?

Post by njs »

Sometime has passed since I looked into this.

But tell me, does this happen only with subforums ? or do you have more than 1 subforum and this only happens in a specific one ?
User avatar
dpaanlka
Registered User
Posts: 286
Joined: Wed May 10, 2006 6:48 pm
Location: Chicago, USA
Contact:

Re: Is possible to know if a category has unread forums ?

Post by dpaanlka »

njs wrote:Sometime has passed since I looked into this.

But tell me, does this happen only with subforums ? or do you have more than 1 subforum and this only happens in a specific one ?
Sorry, I think I was a little unclear in what I was saying.

Basically, my subforums register their forums as unread, but not the category. See this image:

Unread Category Screenshot

Image

EDIT: Seems that phpBB's own style doesn't display the image completely, so I added a direct link to the image.

I see what the problem is in the PHP - only checks the parent forum, not the parent category, but I'm hoping perhaps there is an easy way to make it board-wide. I have a huge number of deeply nested subforums - up to five deep. You can see how complex my board hierarchy is here.

Any help appreciated.
phpBB user and evangelist since 2005.
My boards: Info-Mac | System 7 Today
njs
Registered User
Posts: 89
Joined: Mon Feb 18, 2008 10:59 pm
Location: Aveiro, Portugal

Re: Is possible to know if a category has unread forums ?

Post by njs »

I'm sorry, but it is still not clear to me what happens, because in the image you posted it looks alright, you have a forum with new posts, and the category is registered new as well..

Have you tried to debug on the php to check what is happening ? Some echo's or var_dumps usually help in these situations.

Just let me know if you need any further help, I'm glad to help a Mac user :P
User avatar
dpaanlka
Registered User
Posts: 286
Joined: Wed May 10, 2006 6:48 pm
Location: Chicago, USA
Contact:

Re: Is possible to know if a category has unread forums ?

Post by dpaanlka »

njs wrote:I'm sorry, but it is still not clear to me what happens, because in the image you posted it looks alright, you have a forum with new posts, and the category is registered new as well..

Have you tried to debug on the php to check what is happening ? Some echo's or var_dumps usually help in these situations.

Just let me know if you need any further help, I'm glad to help a Mac user :P
If you look at the full image (which is cut off by this board's theme for some reason, hence the direct link to it) you'll see that the right half of the image shows a forum with new posts but the category is not registered as new.

It is a forum that contains subforums, and one of the subforums is unread. So, a subforum with new posts is not registering the category as having new posts using the code provided in this topic.
phpBB user and evangelist since 2005.
My boards: Info-Mac | System 7 Today
njs
Registered User
Posts: 89
Joined: Mon Feb 18, 2008 10:59 pm
Location: Aveiro, Portugal

Re: Is possible to know if a category has unread forums ?

Post by njs »

I'm really sorry, I didn't look at the full image..

To be honest, I don't understand why is that different from the previous category, if that works for one it should work for both, I don't see any difference.

Do the following, enter the "Hardware" category (when new) directly (http://www.info-mac.org/viewforum.php?f=3) and check if the new still remains afterwards.

I have no clues :(
User avatar
dpaanlka
Registered User
Posts: 286
Joined: Wed May 10, 2006 6:48 pm
Location: Chicago, USA
Contact:

Re: Is possible to know if a category has unread forums ?

Post by dpaanlka »

njs wrote:I'm really sorry, I didn't look at the full image..

To be honest, I don't understand why is that different from the previous category, if that works for one it should work for both, I don't see any difference.
I'm pretty sure its because the forum does not actually contain any new posts itself, rather one of its subforums does.

Code: Select all

$cat_unread = false;
foreach ($forum_rows_copy as $frows)
{
    if ($frows['parent_id'] == $row['forum_id'])
    {
        $cat_unread = (isset($forum_tracking_info[$frows['forum_id']]) && $frows['orig_forum_last_post_time'] > $forum_tracking_info[$frows['forum_id']]) ? true : false;
    }
    if ($cat_unread) break;
}
The above is only checking for unread posts in the immediate children of the categories, but not their subforums. In order for phpBB to natively show the unread forum icon, I'm assuming there is something more complex elsewhere in the system than simply the above.

"Official NaSoLab Support Forum" does not have any topics in it, it contains four subforums, and one or more of those subforums containing new posts does not trigger the unread category flag.

One idea I have is - perhaps there is a way to check whether or not the unread flag is being applied to each forum id natively by phpBB.
Do the following, enter the "Hardware" category (when new) directly (http://www.info-mac.org/viewforum.php?f=3) and check if the new still remains afterwards.
Yes it does.
phpBB user and evangelist since 2005.
My boards: Info-Mac | System 7 Today
njs
Registered User
Posts: 89
Joined: Mon Feb 18, 2008 10:59 pm
Location: Aveiro, Portugal

Re: Is possible to know if a category has unread forums ?

Post by njs »

That might be the case for subforums :( As I told you I never intended it to work with subforums.

You might have to iterate again through forum_rows_copy but then it would be a PIA for a large amount of forums and subforums, since that list is iterated for EVERY forum ... you see the computing complexity here...

Have you tried to contact a phpbb Dev to check if there's any other option ? I assume that there is code working for forums->subforums->subforums so it should be easy to adapt to category->forums->subforums->subforums

:)
User avatar
dpaanlka
Registered User
Posts: 286
Joined: Wed May 10, 2006 6:48 pm
Location: Chicago, USA
Contact:

Re: Is possible to know if a category has unread forums ?

Post by dpaanlka »

I have not contacted anyone at phpBB directly (is that even possible?) but hopefully someone will spot this topic!

If I figured out a solution or learn any more I'll post an update here.
phpBB user and evangelist since 2005.
My boards: Info-Mac | System 7 Today
Locked

Return to “[3.0.x] Styles Support & Discussion”