Board Marked Read but unread Messages in it

Started by neugi, January 10, 2012, 11:20:19 AM

Previous topic - Next topic

neugi

Hi,

i've got a costumer that is now using smf 2.0.2 before he used phpbb3.

in phpbb3 in a board where 3 posts are marked as unread he took a look into one of the posts, but not in the 2 other, when he gosed back to the overview the board still was marke unread.

in smf, when he reads one post in a board, the whole board is marked read, but there are still 2 unread posts in this board.

he is now claiming this is a but in smf and he want's to have such a feature in smf.

is there something i can do extend oder activate?

best

Oldiesmann

It isn't a bug at all. That's how SMF works - when you view the list of topics in a board (or view a topic in the board itself), the board is marked as read. It means that there haven't been any new topics in the board since you last read it.

If it really is that important to have the old functionality, you can make the following code changes, but I can't guarantee that this won't mess up other functionality...

Sources/Display.php

Find and remove
// Mark board as seen if we came using last post link from BoardIndex. (or other places...)
if (isset($_REQUEST['boardseen']))
{
$smcFunc['db_insert']('replace',
'{db_prefix}log_boards',
array('id_msg' => 'int', 'id_member' => 'int', 'id_board' => 'int'),
array($modSettings['maxMsgID'], $user_info['id'], $board),
array('id_member', 'id_board')
);
}


Sources/MessageIndex.php

Find and remove
// We can't know they read it if we allow prefetches.
if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch')
{
ob_end_clean();
header('HTTP/1.1 403 Prefetch Forbidden');
die;
}

$smcFunc['db_insert']('replace',
'{db_prefix}log_boards',
array('id_msg' => 'int', 'id_member' => 'int', 'id_board' => 'int'),
array($modSettings['maxMsgID'], $user_info['id'], $board),
array('id_member', 'id_board')
);

if (!empty($board_info['parent_boards']))
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}log_boards
SET id_msg = {int:id_msg}
WHERE id_member = {int:current_member}
AND id_board IN ({array_int:board_list})',
array(
'current_member' => $user_info['id'],
'board_list' => array_keys($board_info['parent_boards']),
'id_msg' => $modSettings['maxMsgID'],
)
);

// 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]);
Michael Eshom
Christian Metal Fans

neugi

Hi,

thx for the repley i'll implement this solution and will have a look if the costumer ist okay with it.

thx

JimM


If this is solved, please mark it solved by clicking the Mark Topic Solved link at the bottom left.

Jim "JimM" Moore
Former Support Specialist

alsthom

Hi!
I was looking excaclty for this and I post here just to confirm that it is working!!!
Thank you :)

alsthom

In fact this method  is working with a little small issue;
It shows as unread your own posts/messages! You can only mark them as read only if you hit the button "mark as read".

I mean that I reply to a topic and then it shows my own answer as unread.

Could this be resolved? Perhaps if I add something or remove something from the above files?

I really need  this "old way" of handling read/unread posts but without this small issue that I describe.

Can you help me please?

alsthom

I bump this just to clarify this issue; it shows as unread, my own post, to me. It should show my own post as unread at the others and not me, right?

Arantor

Well, it's kind of rude to bump only after a few hours ;)

Your own posts should not be marked unread. It doesn't do it here for example.

alsthom

You're right Arandor. Sorry :-[

As you can see, I deleted some lines from display.php and messageindex.php as described above. Perhaps...well 99% that is cousing this. But I wonder if somehow I could solve it.
I will wait, if someone knows... no prob. ;)

Arantor

It is exactly that - you've removed most of the code that relates to logging things as read.

alsthom


Oldiesmann

I'm not sure what could be causing that problem. The code I posted above doesn't deal with marking topics as read. That particular code is in Subs-Post.php.
Michael Eshom
Christian Metal Fans

alsthom

Basicaly I have no idea about coding :(

But if it helps this issue started when I remove those lines (as 3rd post says).

alsthom

As I understand, something is related to those lines I deleted  (as mentioned by Oldiesmann at the 3rd post).

Could this be a server issue? Sorry if I sound silly, but I think this didn't happen to my previous server. You can see that if you check my first post on this topic. I confirmed that the above trick is working! I moved since then to a new server.....

I don't know what else to think or where to check.

Please people, give me your suggestions.

Thank you.

alsthom

Still nothing?  :-[ :'( :-[ :'( :(

Just a thougt or a suggestion would be appreciated.

Thank you.

Colin

We aren't to sure as it isn't the edits that were listed above that would have made this happen. Did you take a backup?
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

alsthom

Hello Colin.
The sure thing is that  occurs when I remove the lines. If I get them back everything is ok but I don't like the default behavior of the forum. It marks the boards as read but inside there are left many topics unread.

The removing of that lines , solves this problem but it triggers a new. The poster sees as unread his own post.

I found here something  similar  but I haven't got the knowledge what to do: http://www.simplemachines.org/community/index.php?topic=410322.0
Somewhere it says
"// 1. mark board as unread: delete the board from log_boards - we want to show everyone except us that we've edited something important"

That's what I would like: to show everyone that there is a new post except the poster (for his post).

Best Regards


alsthom

Please allow me to bump this once again.

In the meantime I think that this topic had an update from Emmanuelle(?) , couse I saw it in notification mail but I can't find it. Maybe it's deleted?

Anyway I would really appreciate your help-info-ideas-instructions.

Thank you!

alsthom

While searching I found this topic http://www.simplemachines.org/community/index.php?topic=61428.20
I know that it's for an earlier version of smf so I tried to change it to look like version 2.0.2

On the last lines there is Parse error: syntax error, unexpected T_ELSE in /home/amnizia1/public_html/forum/Sources/MessageIndex.php on line 208
Can you check this code for me, please? What is wrong?

// Mark boards as readed if there aren't any new topics any more
// Search all unreaded topics
$request = db_query("
SELECT COUNT(*)
FROM {$db_prefix}topics AS t
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
WHERE t.ID_BOARD = $board
AND IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) < t.ID_LAST_MSG", __FILE__, __LINE__);
list ($unreadtopics) = mysql_fetch_row($request);
mysql_free_result($request);

// All topics are readed, mark them as readed
if ($unreadtopics == 0)
db_query("
REPLACE INTO {$db_prefix}log_boards
(ID_MSG, ID_MEMBER, ID_BOARD)
VALUES ($modSettings[maxMsgID], $ID_MEMBER, $board)", __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]);

$request = $smcFunc['db_query']('', '
SELECT sent
FROM {db_prefix}log_notify
WHERE id_board = {int:current_board}
AND id_member = {int:current_member}
LIMIT 1',
array(
'current_board' => $board,
'current_member' => $user_info['id'],
)
);
$context['is_marked_notify'] = $smcFunc['db_num_rows']($request) != 0;
if ($context['is_marked_notify'])
{
list ($sent) = $smcFunc['db_fetch_row']($request);
if (!empty($sent))
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}log_notify
SET sent = {int:is_sent}
WHERE id_board = {int:current_board}
AND id_member = {int:current_member}',
array(
'current_board' => $board,
'current_member' => $user_info['id'],
'is_sent' => 0,
)
);
}
}
$smcFunc['db_free_result']($request);
}
else
$context['is_marked_notify'] = false;
}

emanuele

The code you posted is a mixture of SMF 1.x and 2.0 code, there are some non matching brackets and column names are wrong.

(yes, I posted but then deleted the message because not relevant.)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Advertisement: