News:

Wondering if this will always be free?  See why free is better.

Main Menu

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.

alsthom

Can you /anyone make it work? Is this a hard job?


alsthom


alsthom

Everybody seems to give up on this.

I give up, too.

emanuele

I kept this unread, so I didn't give up...only time limits...
Attach your MessageIndex.php.

The query in Subs-Boards.php should be:
// This allows Snakehit's mod to detect posts that have
// been changed from the read state to the unread state
$smcFunc['db_insert']('replace',
'{db_prefix}log_boards',
array('id_msg' => 'int', id_member' => 'int', 'id_board' => 'int'),
array($earlyMsg, $user_info['id'], $board),
array()  // Don't remember what I have to put here because I don't remember the indexes of log_boards if any...
);


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.

alsthom

Thank you.
I will try that.

I attach the messageindex.php

alsthom

We finnally moved to phpbb :'(
The only good thing in phpbb is the handling of the new unread posts. Only that!
I will continue to hope that someone can fix this.
I wonder if I should donate someone to do it.


Colin

Hi Alsthom,
I am sorry to hear we lost you. I hope this will be added as a mod in the near future and you can give it a try then.

"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

alsthom

God knows how I am waiting for this!
In fact I was testing smf theese two months but I am really IMPRESSED! Fast, excellent and with simple and powerfull admin panel. Phpbb is a pain to work with, BUT it has this "feature" that my users want. (I want it, too).

Anyway please don't close this topic. I hope that someone, someday will fix it.

emanuele

The messageindex should look like the one attached.


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.

MrPhil

So, as explained earlier, SMF's philosophy is that looking inside a board causes it to be marked "Read", even if there are still unread messages within it. If you want "Read" to mean "there are no unread messages inside it", that should be quite possible. You would have to look at all the topic "read/unread" flags that will be listed inside the board to see if there are any unread messages. That's probably a bit more of a database load. @emanuele, is that what the MessageIndex.php you just attached doing? If it works for @alsthom, perhaps it could be made a mod?

emanuele

It's part of the changes described in the linked topic. It should work, but I didn't check it, just trusted the topic. :P


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.

MrPhil

Maybe SMF needs different icons for the boards --

  • You have looked in the board since the last update, and have no unread messages
  • You have looked in the board since the last update, but still have some unread messages
  • The board has been updated since you last looked, and has unread messages
Maybe it could be done better with a base icon or two (current updated/not updated since your last visit), and add-on overlays (locked*, pinned*, unread messages subicons)? Does it cost any more (in processing cycles) to tell if the board has been updated since you were last in there, versus telling if there are any unread messages? If they can both be done on the same pass, it might be worth distinguishing between the two.

* useful for topics, but I don't think they're currently used for boards

emanuele

The issue is usually not the icons, but the fact that to obtain that effect you need to run few queries more on each messageindex/boardindex page load.
Of course it may not be an issue, but it could also be...


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.

alsthom

I think that the problem is relaying somewhere else, but I don't have the knowledge to look for it.

If you remove some lines of code, as described here
http://www.simplemachines.org/community/index.php?topic=465097.msg3248028#msg3248028
the system is behaving excactly as phpbb (or as I would like it).

But it shows as unread the poster's post to the poster himself. I think this is the point that needs attention.

On the other hand (with the old mod of snakehit) it doesn't work in 2.0.2.
The messageindex that emanuelle has attached  has error in line 215 (can't recall it now)

Advertisement: