News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

"Board Has New Post" Indicator

Started by Axiem, October 12, 2005, 11:43:44 AM

Previous topic - Next topic

Axiem

Here is the scenario, as it currently happens on my board:

1. While I am logged out, there are two posts made to board "Randomness", each in a separate thread
2. When I log back in, the board index indicates that there is a new post in "Randomness" by lighting up the icon to the left.
3. I go into Randomness, and see the "new" indicator on the two threads. I go into one thread, and do stuff.
4. I then use the breadcrumbs to return to the Board Index without having looked at the other thread. The indicator is not lit--that is, it is telling me that there are new new posts in "Randomness". However, if I were to go into that board, it will still consider that other thread as "new".

I suspect this is the intended functionality: that is, it turns off the indicator as soon as you visit the board. However, I would like the functionality to be slightly different: I want it to light up the indicator until there are no "new" posts on the board.

I suspect it is somewhere in Sources/BoardIndex.php, but I am rather unfamiliar with the codebase, and am rather unsure what to change. Could someone please help me?

(Crystal Ball Information: http://mtcs.truman.edu/~anime/forum [nofollow] running SMF 1.1 RC 1 with no mods)
Crystal Ball Information:
http://anime.truman.edu/forum [nofollow]
SMF 1.1 RC 1
Minor Mods
Custom Theme

Oldiesmann

This is intended functionality. However, it's quite easy to change this functionality...

Sources/MessageIndex.php

Find and remove:

db_query("
REPLACE INTO {$db_prefix}log_boards
(logTime, ID_MEMBER, ID_BOARD)
VALUES (" . time() . ", $ID_MEMBER, $board)", __FILE__, __LINE__);
if (!empty($board_info['parent_boards']))
{
db_query("
UPDATE {$db_prefix}log_boards
SET logTime = " . time() . "
WHERE ID_MEMBER = $ID_MEMBER
AND ID_BOARD IN (" . implode(',', array_keys($board_info['parent_boards'])) . ")
LIMIT " . count($board_info['parent_boards']), __FILE__, __LINE__);

// We've seen all these boards now!
foreach ($board_info['parent_boards'] as $k => $dummy)
{
if (isset($_SESSION['topicseen_cache'][$k]))
unset($_SESSION['topicseen_cache'][$k]);
}
}

if (isset($_SESSION['topicseen_cache'][$board]))
unset($_SESSION['topicseen_cache'][$board]);


That will make it so a board will not get marked read until you've actually seen every post in that board. However, many people may find this annoying.
Michael Eshom
Christian Metal Fans

Axiem

Our previous forum software operated that way, and I think it makes more sense to keep in that tradition.

I applied the change (by commenting it out, instead of deleting it, but same effect). And it does work by not marking the forum unread if there's a "new" post in it. However, once all of the posts are read, it doesn't unindicate the having-read-everything by dimming the icon; that is, it says there's new posts on the board when there aren't anymore.

I'm not quite sure what the problem is?
Crystal Ball Information:
http://anime.truman.edu/forum [nofollow]
SMF 1.1 RC 1
Minor Mods
Custom Theme

Madley

Yeah, this is a good question!

I try to remove the code too, but i got the same problem. Even if there aren't new post in section, the icon doesn't change, is always blue, not gray...

Anyone as a solution?

Thanks...  ;)

Oldiesmann

The problem is, the only way to do this is to count the entries in the log_topics table for the current user and board, then compare that to the number of topics in that board. This would probably work, but this might slow things down on larger boards, and might make other things not work properly...
Michael Eshom
Christian Metal Fans

Madley

Thanks Oldiesmann for your answer.

But if we put a control, simplier than your, like this:

- if there are new post in board, so icon ON;
- else (if there aren't new post) icon OFF;

Isn't possible to place this kind of control in PHP?  I ask you because I don't know this code...

Thanks

Oldiesmann

SMF doesn't actually determine whether or not there are new topics in a board when deciding whether or not it should be considered "read" - it basically looks to see if the board has been updated since you last looked at it. Similarly, SMF looks to see if the last message in a topic has been posted or modified since you last read that topic (or marked it as "read") when determining whether or not a topic is new.

There are two options then:

1. Everytime you view the board index, go through the log_topics table and see if any topics in that particular board are new (this would only slow things down).

2. Store the board ID with the entries in the log_topics table (much faster, but requires modifying several other files [BoardIndex.php, Display.php, Profile.php, Recent.php, probably others as well] and adding a new column to the log_topics table). This might also cause problems with the caching functions used in 1.1...

The second method would probably work pretty well, but it would require a lot of modification to make it work properly.
Michael Eshom
Christian Metal Fans

Madley

I understand....  :(

Thanks for your help... So I wish someone make a MOD...  :P

Advertisement: